在Google Play控制台发布前报告的“稳定性”部分中,我需要修复此错误:
Galaxy S9
测试ID: 2 测试持续时间::300秒 型号名称::Galaxy S9 制造商:三星 Android版本::Android 8.0 语言环境: es_US 屏幕尺寸:1080×2220 屏幕密度(dpi):480 RAM: 4096 MB OpenGL ES版本: 3.2 原生平台: armeabi-v7a CPU品牌:高通 CPU型号: SDM845
Issue: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
FATAL EXCEPTION: main
Process: [...], PID: 25180
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4489)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4532)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at com.easy.facebook.android.facebook.FBLoginManager.loginSuccess(FBLoginManager.java:99)
at [...].FacebookSignUp.onActivityResult(FacebookSignUp.java:187)
at android.app.Activity.dispatchActivityResult(Activity.java:7539)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4485)
... 9 more
我怀疑此问题可能是由于我的Facebook库太旧而发生的。在我的app/build.gradle
中,我正在使用此Facebook库:
implementation 'com.facebook.android:facebook-android-sdk:3.23.1'
我确信它已经很老了,很可能在许多方面已被弃用。虽然它仍然有效,但是可能是我看到此错误的原因。另外,我正在使用这个:
dependencies {
...
implementation files('libs/easyfacebookandroidsdk_2.3.jar')
....
}
该Facebook库一定是原因。我对在错误中看到的NullPointerException
的修复有任何想法吗?我想最好的办法应该是升级那些非常老的Facebook库。
答案 0 :(得分:0)
问题不是Facebook。检查日志后,真正的问题是:
E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: [package name], PID: 5893
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient;
at com.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.impl.client.DefaultHttpClient" on path: DexPathList[[zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/base.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_dependencies_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_0_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_1_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_2_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_3_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_4_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_5_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_6_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_7_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_8_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/lib/x86, /system/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.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
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)
解决方案是在我的<application>
的{{1}}部分中加入以下行:
AndroidManifest.xml
这在https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p上有解释。