Firebase API initialization failure after renaming package name - android

I am getting FirebaseApp: Firebase API initialisation failure. error after renaming application package name, but with the original package name it is working fine
I have created new firebase app for new package as well as using new google-json file.
error log:
09-07 17:39:56.940 10181-10181/com.upliftapp D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
09-07 17:39:56.952 10181-10181/com.upliftapp E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:707)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zztv;
at com.google.firebase.crash.internal.config.flag.Flags.<clinit>(Unknown Source:10)
at com.google.firebase.crash.internal.config.flag.Flags.initialize(Unknown Source:0)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source:4)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(SourceFile:739) 
at com.google.firebase.FirebaseApp.zze(SourceFile:707) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
at android.app.ActivityThread.-wrap1(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
09-07 17:39:56.953 10181-10181/com.upliftapp E/FirebaseApp: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zztv" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/base.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_dependencies_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_0_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_1_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_2_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_3_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_4_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_5_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_6_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_7_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_8_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/base.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 24 more
09-07 17:39:56.991 10181-10181/com.upliftapp V/FA: Registered activity lifecycle callback
09-07 17:39:56.993 10181-10181/com.upliftapp I/FirebaseInitProvider: FirebaseApp initialization successful
09-07 17:39:57.040 10181-10181/com.upliftapp E/com.facebook.internal.AttributionIdentifiers: getAttributionIdentifiers should not be called from the main thread
09-07 17:39:57.055 10181-10198/com.upliftapp I/zygote: Background concurrent copying GC freed 13187(4MB) AllocSpace objects, 3(56KB) LOS objects, 52% free, 1392KB/2MB, paused 329us total 107.573ms
09-07 17:39:57.094 10181-10216/com.upliftapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
09-07 17:39:57.158 10181-10215/com.upliftapp V/FA: Collection enabled
App package, google app id: com.upliftapp, 1:456357737763:android:898ccf45fd84a88b
09-07 17:39:57.158 10181-10215/com.upliftapp I/FA: App measurement is starting up, version: 12451
To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.upliftapp
09-07 17:39:57.158 10181-10215/com.upliftapp D/FA: Debug-level message logging enabled
09-07 17:39:57.176 10181-10215/com.upliftapp V/FA: Connecting to remote service
09-07 17:39:57.195 10181-10215/com.upliftapp V/FA: Connection attempt already in progress
09-07 17:40:27.011 10181-10212/com.upliftapp E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
09-07 17:40:34.157 10181-10192/com.upliftapp I/zygote: Thread[3,tid=10192,WaitingInMainSignalCatcherLoop,Thread*=0xe3059c00,peer=0x16440ad0,"Signal Catcher"]: reacting to signal 3
09-07 17:40:34.183 10181-10192/com.upliftapp I/zygote: Wrote stack traces to '[tombstoned]'
this is the log i am getting.

When you first connect your Android App to your Firebase App to enable the FCM a file named google-services.json was obtained. That file contains the package name of your app and has the information needed to connect to Firebase.
If you've changed the package name, go open and edit that file with the new package name. Or go to the Firebase Console and get a new google-services.json file with the correct package name.
That's why old one work and new does not

Related

FirebaseApp with name APP_ID doesn't exist. Available app names: [DEFAULT]

I have a react native app that has firebase modules such as
"#react-native-firebase/app": "^14",
"#react-native-firebase/messaging": "^14",
App is working fine with debugging mode, Apk is also fine, but when I publish it to google play internal testing, App is crashing after installing it with below error! There is no issue with app ids and json file. I have already double checked it.
FATAL EXCEPTION: mqt_native_modules
Process: com.app, PID: 26684
java.lang.IllegalStateException: FirebaseApp with name XXXXXXXXXXXXX doesn't exist. Available app names: [DEFAULT]
at com.google.firebase.FirebaseApp.getInstance(Unknown Source:83)
at io.invertase.firebase.messaging.ReactNativeFirebaseMessagingModule.getToken(Unknown Source:0)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:148)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:1012)
2023-01-15 01:35:51.642 1629-2656 ActivityManager
pid-1629

Ionic Capacitor firebase push notification, error:Default FirebaseApp is not initialized in this process

I am new to Capacitor and have migrating my Cordova project to Capacitor.
I trying to get my notification messages working. Therefore i followed the steps shown in
https://capacitor.ionicframework.com/docs/guides/push-notifications-firebase/
Once i build my project, i am opening the project and Android Studio starts. I preform a run, and the app the starts to get downloaded on to my phone, which i then run.
And i get this error message shown below when it comes registering my phone for notification messages.
Am i missing a step?
The google-services.json is also placed in Andriod-->App
Thanks
E/Capacitor: Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:515)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.aardra.cloud. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##19.3.0:184)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(com.google.firebase:firebase-messaging##20.1.2:1)
at com.getcapacitor.plugin.PushNotifications.register(PushNotifications.java:82)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99) 
at com.getcapacitor.Bridge$1.run(Bridge.java:515) 
at android.os.Handler.handleCallback(Handler.java:873) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:201) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
E/AndroidRuntime: FATAL EXCEPTION: CapacitorPlugins
Process: com.aardra.cloud, PID: 749
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.getcapacitor.Bridge$1.run(Bridge.java:524)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:515)
at android.os.Handler.handleCallback(Handler.java:873) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:201) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.aardra.cloud. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##19.3.0:184)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(com.google.firebase:firebase-messaging##20.1.2:1)
at com.getcapacitor.plugin.PushNotifications.register(PushNotifications.java:82)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99) 
at com.getcapacitor.Bridge$1.run(Bridge.java:515) 
at android.os.Handler.handleCallback(Handler.java:873) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:201) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
I had the same problem. In my case I forgot to put google-services.json in android/app folder.
Verify:
google-services.json be in android/app folder and your Android package name should match the appId from your capacitor.config.json file.
We used com.mydomain.myappname for this Capacitor app ID, so that is what we’ll use for this entry.
capacitor.config.json has PushNotifications setup:
{
...
"plugins": {
"SplashScreen": {
...
},
"PushNotifications": {
"presentationOptions": ["badge", "sound", "alert"]
}
},
...
}
Then build your js project and sync.
npx cap sync android
npx cap open android
And build your Android app or test in an emulator.

Android In App billing fails with repsonse code 6

I'm using the Billing Manager provided in googlesamples to handle in app purchases in my android app. Everything seems to work until I click buy and am greeted with the error message:
The Transaction could not be completed.
From the logs I can see that I am getting a response code 6 ("Fatal error during the API action") back from the server. Additionally I can see two suspicious errors during the purchasing process:
E/DatabaseUtils: Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15168)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2492)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:688)
at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
E/Parcel: Class not found when unmarshalling: com.google.android.finsky.billing.common.PurchaseParams
java.lang.ClassNotFoundException: com.google.android.finsky.billing.common.PurchaseParams
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at android.os.Parcel.readParcelableCreator(Parcel.java:2140)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.os.Parcel.readValue(Parcel.java:2020)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2321)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getString(Bundle.java:1118)
at android.content.Intent.getStringExtra(Intent.java:5151)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1468)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1063)
at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4385)
at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:254)
at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4266)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2712)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
Caused by: java.lang.NoClassDefFoundError: com/google/android/finsky/billing/common/PurchaseParams
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:251) 
at java.lang.Class.forName(Class.java:216) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2140) 
at android.os.Parcel.readParcelable(Parcel.java:2104) 
at android.os.Parcel.readValue(Parcel.java:2020) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2321) 
at android.os.Bundle.unparcel(Bundle.java:249) 
at android.os.Bundle.getString(Bundle.java:1118) 
at android.content.Intent.getStringExtra(Intent.java:5151) 
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1468) 
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1063) 
at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4385) 
at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:254) 
at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4266) 
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260) 
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2712) 
at android.os.Binder.execTransact(Binder.java:404) 
at dalvik.system.NativeStart.run(Native Method) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.finsky.billing.common.PurchaseParams" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:251) 
at java.lang.Class.forName(Class.java:216) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2140) 
at android.os.Parcel.readParcelable(Parcel.java:2104) 
at android.os.Parcel.readValue(Parcel.java:2020) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2321) 
at android.os.Bundle.unparcel(Bundle.java:249) 
at android.os.Bundle.getString(Bundle.java:1118) 
at android.content.Intent.getStringExtra(Intent.java:5151) 
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1468) 
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1063) 
at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4385) 
at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:254) 
at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4266) 
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260) 
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2712) 
at android.os.Binder.execTransact(Binder.java:404) 
at dalvik.system.NativeStart.run(Native Method) 
However I am not sure that there is a connection between the errors and the failing of the purchase.
Any idea where I went wrong?
Try the solution from this github forum:
Fixed bug w/ null vs. empty payload:
Changes Proposed in this pull request:
Promote null payloads to string.Empty to prevent confusion between the two. Empty payload strings get deserialized as null causing it to
appear as though the purchase failed.
Initialize tcsPurchase earlier to prevent a possible race condition.
The said bug was first discussed here.

RealmIOException: Failed to access: . make_dir() failed

I get this issue when I installed app from MDM(Mobile iron) where application will be wrapped for security purpose.
But it works fine if I install from Android studio,
Can any one please give solution ?
Ream : 1.0.1
minSDK: 18
Stack trace:
Unable to start activity ComponentInfo{forgepond.default.test/com.default.SplashActivity}:
io.realm.exceptions.RealmIOException:
Failed to access: . make_dir() failed: No such file or directory path: /data/user/0/com.default.test/files/default.realm.management
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5794)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: io.realm.exceptions.RealmIOException: Failed to access: . make_dir() failed: No such file or directory path: /data/user/0/com.default.test/files/default.realm.management
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:95)
at io.realm.internal.SharedGroup.(SharedGroup.java:74)
at io.realm.internal.SharedGroupManager.(SharedGroupManager.java:49)
at io.realm.BaseRealm.(BaseRealm.java:81)
at io.realm.Realm.(Realm.java:139)
at io.realm.Realm.createAndValidate(Realm.java:250)
at io.realm.Realm.createInstance(Realm.java:230)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getInstance(Realm.java)
As we wrapped using Gen1 wrapper technology which has no external storage access permission is the issue. When we tried with Gen2 wrapper it works fine.

Unable to instantiate application class

8-03 11:35:19.736 5040-5043/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
08-03 11:35:19.863 16408-16408/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app, PID: 16408
java.lang.RuntimeException: Unable to instantiate application com.app: java.lang.ClassNotFoundException: Didn't find class "com.app" on path: DexPathList[[zip file "/data/app/com.app-2/base.apk"],nativeLibraryDirectories=[/data/app/com.app-2/lib/arm, /data/app/com.app-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.app" on path: DexPathList[[zip
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newApplication(Instrumentation.java:1014)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376) 
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6123) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) 
08-03 11:35:19.983 1490-1523/? E/BatteryStatsService: no controller energy info supplied
Solved above problem by disabling the instant Run
I have seen this problem on more than one thread and it is almost always that the Application class name is absent, misspelled, misnamed, or in the wrong package in the manifest.
Double check your manifest and notice if the Application name is set and if it is green or red? Your app will compile even if it is red--or indicating that there is an error.
BTW this happened to me with Instant Run disabled. Instant Run is often named as the culprit when clearly the classloader cannot find the Application class, because of a name related problem.

Categories

Resources