I have created an android library, it contains an Activity Class that uses to open camera intent, the library works perfect excepts for the part that invokes the Activity to
zeeshan
I have faced same issue i did lot of research & i fixed hopefully it helps you
Creating .aar file for a project:
- For a library module, .aar file is automatically created by Android Studio. For a project with the any resource file or with the libraries, .aar file can be generated as mentioned in next steps.
- Check the plugin. It should be in as follows, change to library if it is in application, apply plugin: 'com.android.library'
- Open the open right border gradle bar and go to “your project”->Tasks->build and then double click on the assembleRelease. On Building the project, You will find the two .aar files(app-debug.aar and app-release.aar) inside app/build/outputs/aar/ directory. Using .aar file in your project:
Get the “app-release.aar” file and paste it in the libs folder of your project. If libs folder is not present, create a directory named “libs” inside app directory.
Add the following to the app gradle file, repositories { flatDir { dirs 'libs' } } dependencies { compile(name:'app-release', ext:'aar') }
- On sync, your project is ready to use the library files. Note : .aar gradle dependencies has to be added manually in your project app gradle Example:below
Assumption of errors: System.err: java.lang.NoClassDefFoundError:
Solution:
.aar gradle dependencies has to be added manually in your project app gradle