我有一个实现了Facebook登录的Android应用。去年效果非常理想,但是今天我启动了我的应用,并在此行出现了错误:
final LoginButton loginButton = (LoginButton) findViewById(R.id.facebook_login_button);
loginButton.setReadPermissions(Arrays.asList("public_profile,email"));
错误
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.application.GlassFrogg, PID: 28151
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/internal/LoginAuthorizationType;
at com.facebook.login.widget.LoginButton$LoginButtonProperties.setReadPermissions(LoginButton.java:149)
at com.facebook.login.widget.LoginButton.setReadPermissions(LoginButton.java:276)
at com.application.GlassFrogg.LoginScreen.onCreate(LoginScreen.java:184)
at android.app.Activity.performCreate(Activity.java:7326)
at android.app.Activity.performCreate(Activity.java:7317)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3066)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3229)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1926)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
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:1445)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.internal.LoginAuthorizationType" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/base.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_dependencies_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_resources_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_0_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_1_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_2_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_3_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_4_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_5_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_6_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_7_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_8_apk.apk", zip file "/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/lib/arm64, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/base.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_resources_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/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)
... 18 more
Suppressed: java.io.IOException: No original dex files found for dex location (arm64) /data/app/com.application.GlassFrogg-9iEMWqfIsuzThI_-Q3q51w==/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)
E/AndroidRuntime: 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:764)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:847)
at android.app.LoadedApk.getResources(LoadedApk.java:1088)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6031)
at android.app.ActivityThread.access$1200(ActivityThread.java:235)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
... 6 more
由于某种原因,应用崩溃时出现三个错误。谷歌搜索确切的错误代码给了我0条结果(那是第一次)。
我试图更改我请求的读取权限无济于事。我检查了方法是否在最近更新的facebook API中已贬值,但我也不认为这是问题所在。
答案 0 :(得分:0)
我通过更新到最新版本的Facebook API解决了这一问题。在导致崩溃的更新中,某些函数调用略有更改。