Android In App billing fails with repsonse code 6 - android

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.

Related

Firebase login with Google fails after I generated signed APK

It's the first time that I try to release an app on Google Play Store. I used authentification with Google account from Firebase and it worked before, but now if I try to run the app I get an error when I try to sign in.
I added the keys that I generate from the Google Play Console to the Firebase Console but I still get this error:
2020-04-25 14:59:10.863 3668-4853/? E/Parcel: Class not found when unmarshalling: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.os.Parcel.readParcelableCreator(Parcel.java:2843)
at android.os.Parcel.readParcelable(Parcel.java:2797)
at android.os.Parcel.readValue(Parcel.java:2700)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3067)
at android.os.BaseBundle.unparcel(BaseBundle.java:257)
at android.os.BaseBundle.getString(BaseBundle.java:1086)
at android.content.Intent.getStringExtra(Intent.java:7706)
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468)
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419)
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6035)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5887)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3863)
at android.os.Binder.execTransact(Binder.java:682)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2843) 
at android.os.Parcel.readParcelable(Parcel.java:2797) 
at android.os.Parcel.readValue(Parcel.java:2700) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:3067) 
at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
at android.os.BaseBundle.getString(BaseBundle.java:1086) 
at android.content.Intent.getStringExtra(Intent.java:7706) 
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468) 
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419) 
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308) 
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6035) 
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5887) 
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121) 
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3863) 
at android.os.Binder.execTransact(Binder.java:682) 
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2020-04-25 14:59:11.071 3668-8343/? E/Parcel: Class not found when unmarshalling: com.google.android.gms.common.api.Scope
java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.os.Parcel.readParcelableCreator(Parcel.java:2843)
at android.os.Parcel.readParcelable(Parcel.java:2797)
at android.os.Parcel.readParcelableArray(Parcel.java:2905)
at android.os.Parcel.readValue(Parcel.java:2754)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3067)
at android.os.BaseBundle.unparcel(BaseBundle.java:257)
at android.os.BaseBundle.getString(BaseBundle.java:1086)
at android.content.Intent.getStringExtra(Intent.java:7706)
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468)
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419)
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308)
at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:6592)
at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:393)
at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:6309)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:1635)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3863)
at android.os.Binder.execTransact(Binder.java:682)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2843) 
at android.os.Parcel.readParcelable(Parcel.java:2797) 
at android.os.Parcel.readParcelableArray(Parcel.java:2905) 
at android.os.Parcel.readValue(Parcel.java:2754) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:3067) 
at android.os.BaseBundle.unparcel(BaseBundle.java:257) 
at android.os.BaseBundle.getString(BaseBundle.java:1086) 
at android.content.Intent.getStringExtra(Intent.java:7706) 
at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468) 
at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419) 
at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308) 
at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:6592) 
at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:393) 
at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:6309) 
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:1635) 
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3863) 
at android.os.Binder.execTransact(Binder.java:682) 
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2020-04-25 14:59:11.186 4564-4787/? E/cipr: *~*~*~ Channel {0} was not shutdown properly!!! ~*~*~*
Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
java.lang.RuntimeException: ManagedChannel allocation site
at cipq.<init>(:com.google.android.gms#201216021#20.12.16 (040408-306753009):2)
at cipr.<init>(:com.google.android.gms#201216021#20.12.16 (040408-306753009):2)
at cijj.b(:com.google.android.gms#201216021#20.12.16 (040408-306753009):21)
at tdt.a(:com.google.android.gms#201216021#20.12.16 (040408-306753009):24)
at tdt.a(:com.google.android.gms#201216021#20.12.16 (040408-306753009):52)
at ardz.call(:com.google.android.gms#201216021#20.12.16 (040408-306753009):27)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at tkq.b(:com.google.android.gms#201216021#20.12.16 (040408-306753009):12)
at tkq.run(:com.google.android.gms#201216021#20.12.16 (040408-306753009):7)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at tqq.run(:com.google.android.gms#201216021#20.12.16 (040408-306753009):0)
at java.lang.Thread.run(Thread.java:764) ```

Flutter - no class definition found exception on upgrading android native build to flutter build

I'm updating my Android native app to flutter. I've created a new project in flutter code base. Ive updated my version code and name but this exception im getting while installing flutter release APK over Android Native APK. Here is the exception
Class not found when unmarshalling: com.android.packageinstaller.InstallFlowAnalytics
java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
at android.os.Parcel.readParcelable(Parcel.java:2358)
at android.os.Parcel.readValue(Parcel.java:2264)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2614)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.getString(BaseBundle.java:920)
at android.content.Intent.getStringExtra(Intent.java:6183)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2695)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2157)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6336)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6114)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3986)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:324) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2404) 
at android.os.Parcel.readParcelable(Parcel.java:2358) 
at android.os.Parcel.readValue(Parcel.java:2264) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:2614) 
at android.os.BaseBundle.unparcel(BaseBundle.java:221) 
at android.os.BaseBundle.getString(BaseBundle.java:920) 
at android.content.Intent.getStringExtra(Intent.java:6183) 
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:2695) 
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:2157) 
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6336) 
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:6114) 
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:170) 
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3986) 
at android.os.Binder.execTransact(Binder.java:453) 
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
11-23 21:34:04.451 29760-29760/? D/InstallAppProgress: Installation error code: -7
Pleas I'm stuck any hlp would be appreaciated.
Edit:
I found out that error code -7 means INSTALL_FAILED_UPDATE_INCOMPATIBLE. That means that signatures aren't matching. If I manage to change my key signing credentials on play store by reporting a lost key store and signing app with new keystore will solve the problem on playstore for existing users?
The Flutter APK installed successfully by uploading it to Play Console internal test track and updating it from there. Previouly I was trying to update it via putting APK in internal storage.

MultiDex issue: java.lang.ClassNotFoundException: Didn't find class on path: DexPathList

I am facing an issue with my app:
If I deactivate within Android Studio Instant Run, my app crashes upon startup with the stacktrace:
12-29 13:36:37.876 4549-4549/com.mycoolapp.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycoolapp.debug, PID: 4549
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycoolapp.debug/com.myapp.SplashScreenActivity}: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2216)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365) 
at android.app.ActivityThread.access$800(ActivityThread.java:148) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5272) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704) 
Suppressed: java.lang.NoClassDefFoundError: com.myapp.SplashScreenActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.myapp.SplashScreenActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
As far as I have researched this belongs to multidex:
https://developer.android.com/studio/build/multidex.html
Even if I add the multiDexEnabled property to my gradle config the app crashes. Only if I enable InstantRun (which enables multidex in background), the app runs...
If I create an apk the installation works, but the app crashes on startup with the same error.
Since I have as minSDK API Level 21, there should be no other change except of the multiDexEnabled property necessary, right?
So last but not least my answer:
All my configuration for multidex was correct... I don't know why, but after a complete OS restart everything works fine now... :)
Just create new phone on AVD and try to install app on that phone. Hope it will work.
The accepted answer was only a temporary fix for me, after altering code and a few builds the error came back.
After alot of trial and error the real problem was the jdk location my project was using, instead of using the embedded jdk in android studio i was using an installed version from oracle. After going to File > Project Structure > SDK Location and checking Use embedded JDK the problem was fixed for good.
Check if your classpath
'com.android.tools.build:gradle:3.1.0-alpha05'
is up-to-date, had same problem and solved it with a full update.

UrbanAirship app crashes upon receipt of message

Working on upgrading my UrbanAirship to 7.2. No compilation errors and the app runs fine until it receives a push message. At that point, it crashes with the following stack trace:
UALib: ManifestUtils - Unable to find class:
com.urbanairship.push.GCMPushReceiver
java.lang.ClassNotFoundException:
com.urbanairship.push.GCMPushReceiver
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at
com.urbanairship.util.ManifestUtils.validateManifest(ManifestUtils.java:215)
at com.urbanairship.UAirship.validateManifest(UAirship.java:736)
at com.urbanairship.UAirship.executeTakeOff(UAirship.java:343)
at com.urbanairship.UAirship.access$000(UAirship.java:42)
at com.urbanairship.UAirship$2.run(UAirship.java:299)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.urbanairship.push.GCMPushReceiver" on path: DexPathList[[zip file
"/data/app/com.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx-1/lib/arm,
/data/app/com.xxx-1/base.apk!/lib/armeabi-v7a, /vendor/lib,
/system/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:324) 
at java.lang.Class.forName(Class.java:285) 
at
com.urbanairship.util.ManifestUtils.validateManifest(ManifestUtils.java:215) 
at com.urbanairship.UAirship.validateManifest(UAirship.java:736) 
at com.urbanairship.UAirship.executeTakeOff(UAirship.java:343) 
at com.urbanairship.UAirship.access$000(UAirship.java:42) 
at com.urbanairship.UAirship$2.run(UAirship.java:299) 
at java.lang.Thread.run(Thread.java:818) 
Suppressed: java.lang.ClassNotFoundException:
com.urbanairship.push.GCMPushReceiver
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the
boot class loader; no stack trace available
When I check to see if the class is visible (Cmd-O) and start typing, the class comes up immediately.
Has anyone encountered this? I have no idea how to fix it. Thanks.
We renamed GCMPushReceiver to GcmPushReceiver. You should remove all the Urban Airship receivers, services, and activities from your manifest and let auto manifest integration merge them for you.

How to resolve ClassNotFoundException in Android Studio

I have recently migrated my project from Eclipse to Android Studio. Earlier everything was working perfectly, but recently when I started working on it again I am not able to launch the application. Its always showing me the same error. I haven't changed anything on application level, still getting the same result. Here is the log I am getting
FATAL EXCEPTION: main
Process: com.example.android, PID: 6977
java.lang.RuntimeException: Unable to instantiate application com.example.android.MobApplication: java.lang.ClassNotFoundException: Didn't find class "com.example.android.MobApplication" on path: DexPathList[[zip file "/data/app/com.example.android-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:601)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4919)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5721)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.MobApplication" on path: DexPathList[[zip file "/data/app/com.example.android-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:986)
at android.app.LoadedApk.makeApplication(LoadedApk.java:587)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4919)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5721)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Suppressed: java.lang.ClassNotFoundException: com.example.android.MobApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
As I have recently switched my IDE I am facing problems to solve this one. I have also tried the other answers but still unable to solve this error. Kindly help me with this so I can proceed with my project.
Any help would be appreciable.
Thanks
This might be the 65k methods limit. Try to use the solutions in the link.
Edit: For others who stumble this issue - #Salman Khan added multiDexEnabled true to the gradle file (as written in the link) and it solved the problem. It would be still better to read the whole article and follow the steps there.
Replaced lambda with anonymous class:
java.lang.ClassNotFoundException happened in my android studio project in two classes – in both of them there was lambda expressions. After I replaced lambda with anonymous class – the build was successful.
In my case, I needed to edit from:
String id = MyClass.class.toString();
Into:
String id = MyClass.class.getName();
Because .toString() returns something like "class mypackage.MyClass" (instead of "mypackage.MyClass").

Categories

Resources