I have an Android project with an Android application that depends on a pure Java library (and the Java library uses some others compiled jars libraries).
I added the dependencies, I can build the project, but at run time I have a ClassNotFoundException
error.
I had to add to theCLASSPATH
environment variable the path to the jars.
Is there a way to set the classpath locally for the project only, like using the command line option
java –classpath <path to the jars>
in the Android studio Run/Debug Configurations?
android.graphics.Path. The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.
A configuration is simply a named set of dependencies. The compile configuration is created by the Java plugin. The classpath configuration is commonly seen in the buildSrc {} block where one needs to declare dependencies for the build. gradle, itself (for plugins, perhaps).
Open the project where you want to use your cloned library, then select 'File > New > Import Module' from the Android Studio toolbar. Click the three-dotted button and navigate to your cloned repository. Select this repository, then click 'OK. '
First off all, be sure there's a "libs" subfolder in the "app" folder of your project. If there's not, create one. Next, in the app/build.gradle file, add this line of code:
dependencies {
...
compile fileTree(dir:'libs', include: ['*.jar'])
...
}
Place all of your .jar files in the "libs" folder, and voila, you're done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With