java.lang.RuntimeException:无法将结果 ResultInfo{...} 传送到 activity {....FacebookSignUp}:java.lang.NullPointerException:
java.lang.RuntimeException: Failure delivering result ResultInfo{...} to activity {....FacebookSignUp}: java.lang.NullPointerException:
在 Google Play 管理中心预发布报告的 "STABILITY" 部分,我有一个需要修复的错误:
银河 S9
测试编号:2
测试持续时间: 300 秒
型号名称: Galaxy S9
制造商:三星
Android版本:Android8.0
语言环境: es_US
屏幕尺寸: 1080 × 2220
屏幕密度 (dpi): 480
内存: 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 库。
问题不在 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.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.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.access00(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)
解决方案是在我的 AndroidManifest.xml
的 <application>
部分中包含以下行:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
这在 https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p 中有解释。
在 Google Play 管理中心预发布报告的 "STABILITY" 部分,我有一个需要修复的错误:
银河 S9
测试编号:2 测试持续时间: 300 秒 型号名称: Galaxy S9 制造商:三星 Android版本:Android8.0 语言环境: es_US 屏幕尺寸: 1080 × 2220 屏幕密度 (dpi): 480 内存: 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 库。
问题不在 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.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.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.access00(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)
解决方案是在我的 AndroidManifest.xml
的 <application>
部分中包含以下行:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
这在 https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p 中有解释。