Upgraded Android API Level to 31 and then had to update Unity FB sdk (updated FB SDK to fix this).
In the new updated SDK when we try to facebook login we the game crashes and this is the device log
2022-10-18 12:36:22.428 2310-2310/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.risingtidegames.blackdiamondslots.beta, PID: 2310
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/activity/result/ActivityResultRegistryOwner;
at com.facebook.login.LoginManager.logIn(LoginManager.java:838)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:572)
at com.facebook.unity.FBLogin.login(FBLogin.java:163)
at com.facebook.unity.FBLogin.loginWithReadPermissions(FBLogin.java:44)
at com.facebook.unity.FBUnityLoginActivity.onCreate(FBUnityLoginActivity.java:40)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.ClassNotFoundException: androidx.activity.result.ActivityResultRegistryOwner
at com.facebook.login.LoginManager.logIn(LoginManager.java:838)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:572)
at com.facebook.unity.FBLogin.login(FBLogin.java:163)
at com.facebook.unity.FBLogin.loginWithReadPermissions(FBLogin.java:44)
at com.facebook.unity.FBUnityLoginActivity.onCreate(FBUnityLoginActivity.java:40)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)```
Morning everyone,
Whilst trying to integrate Branch.io and Capacitor following their guide (https://help.branch.io/developers-hub/docs/capacitor)
I am receiving this error:
2022-03-30 09:58:21.551 8066-8066/com.aks.cardTwist E/m.aks.cardTwis: Invalid ID 0x00000000.
2022-03-30 09:58:21.554 8066-8066/com.aks.cardTwist D/AndroidRuntime: Shutting down VM
2022-03-30 09:58:21.557 8066-8066/com.aks.cardTwist E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.aks.cardTwist, PID: 8066
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aks.cardTwist/com.aks.cardTwister.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:843)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:806)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:693)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:28)
at com.aks.cardTwister.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:7994)
at android.app.Activity.performCreate(Activity.java:7978)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I have noticed line 6 they tell you to add within AndroidManifest.xml is the cause of the issue
Any advice would be greatly appreciated
I just cant understand the logcat becuse it does not state that the problem acured in my code but in the code that is automaticly generated by using firebase.
2021-06-02 21:55:21.444 11603-11603/com.example.sandwichswitch E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sandwichswitch, PID: 11603
java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.art/javalib/core-oj.jar)
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I'm struggling with exception
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.hubalek.android.apps.reborn.pro/android.service.dreams.DreamActivity}: java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.service.dreams.DreamService$DreamServiceWrapper
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3792)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3968)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8512)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
This issue is exclusive to Samsung devices with Android 11. Does anybody any idea how to fix it?
Except disabling this feature for Samsung phones with Android 11.
I'm afraid it is outside of my code.
Source code for DreamActivity seems to be quite straightforward - https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/service/dreams/DreamActivity.java
Creating an Ionic 5 app with Capacitor, I'm running into this problem where it seems that capacitor.config.json is not being loaded.
This problem came after I've installed #codetrix-studio/capacitor-google-auth, before the project was running on android fine.
{
"appId": "com.luyou.clauncher",
"appName": "c-launchpad",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "www",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
},
"GoogleAuth": {
"scopes": [
"profile",
"email"
],
"serverClientId": "xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", // On my project I'm using the real server client id
"forceCodeForRefreshToken": true
}
}
}
On the android studio the build goes okay but when you try to open the app, it does crash with the following:
D/Capacitor: Starting BridgeActivity
E/Capacitor: Unable to load capacitor.config.json. Run npx cap copy first
java.io.FileNotFoundException: capacitor.config.json
at android.content.res.AssetManager.nativeOpenAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:874)
at android.content.res.AssetManager.open(AssetManager.java:851)
at com.getcapacitor.FileUtils.readFile(FileUtils.java:148)
at com.getcapacitor.CapConfig.loadConfig(CapConfig.java:121)
at com.getcapacitor.CapConfig.loadDefault(CapConfig.java:85)
at com.getcapacitor.Bridge.<init>(Bridge.java:152)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1160)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:73)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:54)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:37)
at com.luyou.clauncher.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
D/Capacitor: Registering plugin: WebView
D/Capacitor: Registering plugin: AdMob
D/Capacitor: Registering plugin: GoogleAuth
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.luyou.clauncher, PID: 11477
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.luyou.clauncher/com.luyou.clauncher.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
at com.getcapacitor.PluginHandle.load(PluginHandle.java:95)
at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:59)
at com.getcapacitor.Bridge.registerPlugin(Bridge.java:464)
at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:419)
at com.getcapacitor.Bridge.<init>(Bridge.java:164)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1160)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:73)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:54)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:37)
at com.luyou.clauncher.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process: Sending signal. PID: 11477 SIG: 9
capacitor.config.json is already on the root path of the project and doing npx cap copy or npx cap sync doesn't solve this problem, but actually is copying the www files. For some reason, the capacitor config simply is just not being copied.
Seems like Capacitor alpha versions are broken, so gonig back to Capacitor 2.4.7 fixes the problem. The capacitor.config.json is loading correctly and the native plugins are loading fine.
awesome, thanks #Adrian Legaspi.
Downgrading to capacitor 2.4.7 solved it for me.
This is what my package.json looks like:
"dependencies": {
...
"#capacitor/android": "^2.4.2",
"#capacitor/core": "2.4.7",
..
},
"devDependencies": {
...
"#capacitor/cli": "2.4.2",
...
}