我已成功从Android模块创建了aar
包。
它包括Realm。
我创建了另一个示例应用程序,我在其中使用aar
作为依赖项。但是,每当我尝试运行该项目时,它都会崩溃。
Process: com.example.abhil.myapplication, PID: 3352
java.lang.NoClassDefFoundError: Failed resolution of: Lio / realm / Realm;
at ai.quinto.business.App.onCreate(App.java: 42)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java: 1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java: 4553)
at android.app.ActivityThread.access$1500(ActivityThread.java: 151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1364)
at android.os.Handler.dispatchMessage(Handler.java: 102)
at android.os.Looper.loop(Looper.java: 135)
at android.app.ActivityThread.main(ActivityThread.java: 5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 698)
Caused by: java.lang.ClassNotFoundException: Didn 't find class "io.realm.Realm" on path: DexPathList[[zip file "/data/app/com.example.abhil.myapplication-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java: 56)
at java.lang.ClassLoader.loadClass(ClassLoader.java: 511)
at java.lang.ClassLoader.loadClass(ClassLoader.java: 469)
at ai.quinto.business.App.onCreate(App.java: 42)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java: 1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java: 4553)
at android.app.ActivityThread.access$1500(ActivityThread.java: 151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1364)
at android.os.Handler.dispatchMessage(Handler.java: 102)
at android.os.Looper.loop(Looper.java: 135)
at android.app.ActivityThread.main(ActivityThread.java: 5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 698)
Suppressed: java.lang.ClassNotFoundException: io.realm.Realm
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java: 781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java: 841)
at java.lang.ClassLoader.loadClass(ClassLoader.java: 504)...13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader;
no stack available
07 - 21 09: 19: 13.400 1159 - 1159 / ? E / EGL_emulation : tid 1159: eglCreateSyncKHR(1865): error 0x3004(EGL_BAD_ATTRIBUTE)
答案 0 :(得分:1)
AAR不包含依赖项。如果将库上载到Maven存储库,则应生成POM文件。或者提供从本地AAR连接您的库的说明