CheckVersionLib icon indicating copy to clipboard operation
CheckVersionLib copied to clipboard

v2.2.3 NoClassDefFoundError

Open TxcA opened this issue 4 years ago • 4 comments

AndroidX项目,

implementation 'com.allenliu.versionchecklib:library:2.2.3'
2019-12-18 09:14:56.550 20962-20962/? E/CrashReport: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/greenrobot/eventbus/EventBus;
        at com.allenliu.versionchecklib.utils.AllenEventBusUtil.sendEventBusStick(AllenEventBusUtil.java:22)
        at com.allenliu.versionchecklib.v2.AllenVersionChecker.cancelAllMission(AllenVersionChecker.java:44)
        at com.allenliu.versionchecklib.v2.ui.VersionService.enqueueWork(VersionService.java:60)
        at com.allenliu.versionchecklib.v2.builder.DownloadBuilder.download(DownloadBuilder.java:333)
        at com.allenliu.versionchecklib.v2.net.RequestVersionManager$1$1.run(RequestVersionManager.java:100)
        at android.os.Handler.handleCallback(Handler.java:907)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.greenrobot.eventbus.EventBus" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.jhx.hyxs-y6dxmQ57qFvUeCaaW65P6g==/base.apk"],nativeLibraryDirectories=[/data/app/com.jhx.hyxs-y6dxmQ57qFvUeCaaW65P6g==/lib/arm, /data/app/com.jhx.hyxs-y6dxmQ57qFvUeCaaW65P6g==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
        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.allenliu.versionchecklib.utils.AllenEventBusUtil.sendEventBusStick(AllenEventBusUtil.java:22) 
        at com.allenliu.versionchecklib.v2.AllenVersionChecker.cancelAllMission(AllenVersionChecker.java:44) 
        at com.allenliu.versionchecklib.v2.ui.VersionService.enqueueWork(VersionService.java:60) 
        at com.allenliu.versionchecklib.v2.builder.DownloadBuilder.download(DownloadBuilder.java:333) 
        at com.allenliu.versionchecklib.v2.net.RequestVersionManager$1$1.run(RequestVersionManager.java:100) 
        at android.os.Handler.handleCallback(Handler.java:907) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:216) 
        at android.app.ActivityThread.main(ActivityThread.java:7625) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
implementation 'com.github.AlexLiuSheng:CheckVersionLib:2.2.3'

会导致项目内自己的Nohttp报错。

2019-12-18 09:19:32.953 23237-23237/? E/xxx: Throwable is : java.lang.Exception | java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/http/UnrepeatableRequestBody;

 

TxcA avatar Dec 18 '19 01:12 TxcA

库使用的okhttp版本'com.squareup.okhttp3:okhttp:3.8.1',可能okhttp版本不同导致api不同

AlexLiuSheng avatar Dec 18 '19 01:12 AlexLiuSheng

针对第一个问题 implementation 'com.github.AlexLiuSheng:CheckVersionLib:2.3.3.1_appcompat'

AlexLiuSheng avatar Dec 18 '19 03:12 AlexLiuSheng

@AlexLiuSheng 很喜欢您的库,有个疑问:关于 上文中的问题 我的项目中也出现了,请问下,根据README说明 androidx项目不应该使用的是2.2.3版本的库吗?是我们对于appcompat/androidx版本理解出现了偏差,还是我们两个人的项目问题,是个例呢?

JeahWan avatar Jan 10 '20 17:01 JeahWan

appcompat: implementation 'com.github.AlexLiuSheng:CheckVersionLib:2.3.3.1_appcompat' androidx: implementation 'com.github.AlexLiuSheng:CheckVersionLib:2.2.3 上面第一个implementation 'com.allenliu.versionchecklib:library:2.2.3'这个是发到jcenter的是appcompat的,之前appcompat发布的时候EventBus打包出了点问题所以发了个2.3.3.1也把库都迁移到jitpack了,androidX:2.2.3我这边测试时没问题的

AlexLiuSheng avatar Jan 17 '20 01:01 AlexLiuSheng