Activity Class cannot be found in AAR file java.lang.NoClassDefFoundError

后端 未结 6 2223
暖寄归人
暖寄归人 2021-01-04 01:54

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

6条回答
  •  无人及你
    2021-01-04 02:41

    zeeshan

    I have faced same issue i did lot of research & i fixed hopefully it helps you

    Creating .aar file for a project:

    1. 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.
    2. Check the plugin. It should be in as follows, change to library if it is in application, apply plugin: 'com.android.library'
    3. 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:
    4. 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.

    5. Add the following to the app gradle file, repositories { flatDir { dirs 'libs' } } dependencies { compile(name:'app-release', ext:'aar') }

    6. 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

提交回复
热议问题