Use custom frame library (android.jar) in Android Studio

I had my own custom environment (android.jar) and you want to use it in Android Studio. I had a description in my build.gradle, for example:

dependencies { compile files('myandroid.jar') } 

But Android Studio still uses the default infrastructure (android.jar). The expected situation is similar to Eclipse, I can arrange the order of the libraries. In Android Studio, I can arrange the order of external libraries and have nothing to do with the default frame library. Is there a way for my customized android.jar to have a higher order than the standard?

Thanks a lot!

+5
source share
4 answers

What you can do is add your .jar to your libs folder, then right-click on it and select add as a library .

Then, if it no longer works, try right-clicking in the project folder and select Open Modules settings . You can manage your dependency and your libraries there.

+1
source

Put this line inside your dependencies:

 provided files('libs/myandroid.jar') 

If still not working, we can add our library to create a classpath. In the build.gradle application, add the following:

 allprojects { repositories { jcenter() } gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:app\\libs\\mylibs.jar') } } } 

I put mylib.jar in app / libs. There, maybe some errors are displayed in the IDE, but the application build will be fine.

+1
source

Try this in your build.gradle file.

 dependencies { compile files('libs/myandroid.jar') } 
0
source

Try the following:

 allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:/mylib.jar') } } } 

http://www.jianshu.com/p/a25a85b6372d
How to place my libraries in front of android.jar by editing build.gradle in Android-Studio

0
source

Source: https://habr.com/ru/post/1234653/


All Articles