I created a JAR that has two .class files in them. I then added the jar to the libs folder and added the dependency into my gradle file by doing this
compile fileTree(dir: 'libs', include: ['*.jar'])
I then run into a strange issue that can be seen in the image below.
I can reference the class and use its methods, but then I do a clean/build project I get errors because the imports didnt resolve. I get a Error:(22, 27) error: package com.android.biomini does not exist
the classes inside the jar should be inside a folder hierarchy similar to the package name. So inside the jar (which is just a zip) you should have com/android/biomini/BioMiniAndroid.class ..
One other remark, the 'com.android' package is already used by android so try using something else like com.yourcompany.biomini
Right click the jar file in libs folder and select 'Add as Library'. It will then get added to build.gradle automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.