类似的问题已经需要提出了。但是由于Android平台兼容性的变化,该版本似乎比以前的版本更复杂。
这是我的Pixel和Pixel2错误日志,它们已针对Android Beta程序进行了注册
08-16 13:20:53.146 9630-9630/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: me.project.android.dev, PID: 9630
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
at com.amazonaws.util.VersionInfoUtils.<clinit>(VersionInfoUtils.java:41)
at com.amazonaws.util.VersionInfoUtils.c(VersionInfoUtils.java:77)
at com.amazonaws.ClientConfiguration.<clinit>(ClientConfiguration.java:43)
//project specific class reference removed
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/me.project.android.dev-0SPRJnc8-4voauRU7Y20zQ==/base.apk"],nativeLibraryDirectories=[/data/app/me.project.android.dev-0SPRJnc8-4voauRU7Y20zQ==/lib/arm64, /data/app/me.project.android.dev-0SPRJnc8-4voauRU7Y20zQ==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.amazonaws.util.VersionInfoUtils.<clinit>(VersionInfoUtils.java:41)
at com.amazonaws.util.VersionInfoUtils.c(VersionInfoUtils.java:77)
at com.amazonaws.ClientConfiguration.<clinit>(ClientConfiguration.java:43)
//project specific class reference removed
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
在运行Android 7.0或更低版本的设备上运行时,使用相同的代码即可。
我也尝试向项目添加依赖项
implementation "commons-logging:commons-logging:1.2"
添加此依赖项可使该应用程序在Pixel和Pixel中运行,但随后在其他所有设备中崩溃,并显示异常
org.apache.commons.logging.impl.LogFactoryImpl does not extend or implement org.apache.commons.logging.LogFactory
我已经尝试在ProGuard中进行所有更改。这是我的proguard配置
-keep class org.apache.commons.logging.impl.LogFactoryImpl
-keep class org.apache.commons.logging.LogFactory
-keepnames class org.apache.commons.logging.impl.* {*;}
-keepnames class org.apache.commons.logging.*
-keepclassmembers class org.apache.commons.logging.impl.* {*;}
-keepclassmembers class org.apache.commons.logging.*
-keepnames interface org.apache.commons.logging.impl.* {*;}
-keepnames interface org.apache.commons.logging.*
仍然导致崩溃。
此问题与Amazon AWS开发工具包-https://github.com/aws/aws-sdk-android/issues/476
有关在AWS更新其SDK以解决此问题之前,有什么解决方法?
答案 0 :(得分:15)
这是一个AWS开发工具包错误,似乎已在version 2.6.30 of the SDK中解决:
修复了一个使用Apache Commons Logging获取记录器的错误 Android 9.0(Pie / API级别28)启动时崩溃。参见拉#521。现在, 如果将Apache Commons Logging添加为 依赖项,否则将使用android.util.Log。
答案 1 :(得分:7)
在清单文件的下面添加此行。
<uses-library android:name ="org.apache.http.legacy" android:required ="false"/>
答案 2 :(得分:7)
要解决此问题,我有依赖性 实现“ commons-logging:commons-logging-api:1.1” 在gradle文件中。
答案 3 :(得分:1)
另一种解决方法是将Servlet.service() for servlet [Jersey REST Service] in context with path [/simple-rest-application] threw exception [A MultiException has 2 exceptions. They are:
1. com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No implementation for br.com.brunots.training.simple_rest_application.dao.UserDAO was bound.
Did you mean?
br.com.brunots.training.simple_rest_application.dao.UserDAO bound at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:15)
at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:14)
2) A binding to br.com.brunots.training.simple_rest_application.dao.UserDAO was already configured at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:15).
at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:14)
2 errors
2. java.lang.IllegalStateException: Unable to perform operation: create on br.com.brunots.training.simple_rest_application.services.UserService
] with root cause
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No implementation for br.com.brunots.training.simple_rest_application.dao.UserDAO was bound.
Did you mean?
br.com.brunots.training.simple_rest_application.dao.UserDAO bound at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:15)
at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:14)
2) A binding to br.com.brunots.training.simple_rest_application.dao.UserDAO was already configured at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:15).
at br.com.brunots.training.simple_rest_application.guice.ApplicationModule.configure(ApplicationModule.java:14)
2 errors
库作为commons-logging
文件添加到您的.jar
文件夹中,而不使用libs/
。确保implementation
位于您的依赖项中。
implementation fileTree(include: ['*.jar'], dir: 'libs')
的来源:
信用: Dale Lim- https://github.com/aws/aws-sdk-android/issues/265#issuecomment-411978696
答案 4 :(得分:0)
```