我正在创建SDK附加组件,因此第三方开发人员可以在android studio中使用API。
我已按照以下链接中的AOSP代码说明进行操作。
https://github.com/gibsson/basic_sdk_addon
注意:我正在为qualcom msm8909处理器和AOSP代码开发它作为Android-N。
在附加组件中,我添加了在以下路径中开发的jar
供应商/检验/
我的包名为com.xyz.led;
sdk-add-on存档的结果在out / host / linux-x86 / sdk_addon / path中生成。
在android studio app / libs文件夹中复制jar文件并单击" Add as library"。
我收到了以下错误。
Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value 1
如果我将范围更改为提供它已编译但在运行时获得以下错误。
> FATAL EXCEPTION: main
Process: >
com.teseledapi, PID: 18319
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/xyz/led/LedTest;
at com.teseledapi.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:6723)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xyz.led.LedTest" on path: DexPathList[[zip file "/data/app/com.teseledapi-2/base.apk"],nativeLibraryDirectories=[/data/app/com.teseledapi-2/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.teseledapi.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:6723)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
有什么想法吗?