How to capture NoClassDefFoundError - java

I'm experiencing this issue when updating to the installreferrer library v2.0. LINK
So when I call to the library's startConnection method it throws:
Process: com.tomatedigital.lottogram, PID: 13424
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/aidl/BaseStub;
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:36)
at com.tomatedigital.lottogram.app.App.saveReferralInfo(App.java:221)
at com.tomatedigital.lottogram.app.App.onCreate(App.java:102)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1182)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I think it is a bug in the library, since if you downgrade to previous versions it works great. I'd like to avoid this crash.
I've tried wrapping the code with a :
catch(Throwable ignore){}
But it keeps crashing. How can I gracefully handle this error?

Short answer: You cannot really gracefully handle this error.
Why? You are still trying to use some stuff out of this library, so it makes no sense in handling this error. Either you remove this library (because you don't need it) or the error itself (classpath issues) must be resolved.
Typically, exceptions like this are critical and you should not try to handle it, because you have a serious error.

Related

INSTALL_PARSE_FAILED_NO_CERTIFICATES in eclipse java photon

I have one old project that runs only in eclipse hence i have downloaded eclipse java photon and configured the ADT tools into it. I have mappped the Android sdk provided by studio with it and tried to run the app into the device but each time i run this app i am getting following error
Installing SLTL.apk...
Installation error: INSTALL_PARSE_FAILED_NO_CERTIFICATES
Please check logcat output for more details.
Launch canceled!
when i checked the logcat i am getting following error
/com.android.defcontainer D/DefContainer: Copying /data/local/tmp/SLTL.apk to base.apk
10-02 14:17:52.233 1957-1990/system_process W/PackageManager: Failed collect during installPackageLI
android.content.pm.PackageParser$PackageParserException: Failed to collect certificates from /data/app/vmdl871259287.tmp/base.apk
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1130)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1057)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:12196)
at com.android.server.pm.PackageManagerService.-wrap25(PackageManagerService.java)
at com.android.server.pm.PackageManagerService$9.run(PackageManagerService.java:10156)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: java.lang.NullPointerException: Attempt to get length of null array
at java.util.jar.Manifest.read(Manifest.java:201)
at java.util.jar.Manifest.<init>(Manifest.java:106)
at java.util.jar.StrictJarFile.<init>(StrictJarFile.java:66)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1072)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1057) 
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:12196) 
at com.android.server.pm.PackageManagerService.-wrap25(PackageManagerService.java) 
at com.android.server.pm.PackageManagerService$9.run(PackageManagerService.java:10156) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
My system configuration is windows 10 and using java 1.8 as compiler with java 1.8 jre , i tried to search lot many threads and blogs but could not find the solution
I have tried editing the Android manifest file too but no luck

Attempt to invoke virtual method 'java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)' on a null object reference

I updated my android studio from 3.1.2 to 3.1.3 and updated my project sdk version to 28 and when i run the application it crashes as soon as it open and throws the following exception,
FATAL EXCEPTION: main
Process: com.google.android.apps.nexuslauncher, PID: 10288
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)' on a null object reference
at android.os.Parcel.createException(Parcel.java:1948)
at android.os.Parcel.readException(Parcel.java:1865)
at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4541)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1660)
at android.app.Activity.startActivityForResult(Activity.java:4574)
at com.android.launcher3.Launcher.startActivityForResult(SourceFile:1394)
at android.app.Activity.startActivity(Activity.java:4889)
at com.android.launcher3.Launcher.startActivitySafely(SourceFile:2000)
at com.android.launcher3.Launcher.startAppShortcutOrInfoActivity(SourceFile:1850)
at com.android.launcher3.Launcher.onClick(SourceFile:1703)
at android.view.View.performClick(View.java:6579)
at android.view.View.performClickInternal(View.java:6556)
at android.view.View.access$3100(View.java:777)
at android.view.View$PerformClick.run(View.java:25660)
at android.os.Handler.handleCallback(Handler.java:819)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6656)
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:823)
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.LoadedApk.createAppFactory(LoadedApk.java:224)
at android.app.LoadedApk.<init>(LoadedApk.java:152)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:2043)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1998)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1970)
It is a problem of API P emulator. On API 28, 27 it works right.
As CoolMind said, It is a problem in API P emulator, you can solve it by updating your Google APIs Intel System Image in Android SDK.
Add these two lines in your gradle.properties file and then build project. After i added these lines, Android Studio showed stacktrace in Logcat.I fixed those issues and then my app started working.
android.enableD8.desugaring = true
android.enableR8 = true

java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo

I know this question may be duplicate but I have tried many solutions but I am unable to make my app work. It should be noted that I have enabled Multidex but still getting below error. I am creating a react native app.
FATAL EXCEPTION: main
Process: com.xxxxxx.yyyyyyyy, PID: 3978
java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5049)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
If you are developing a react native application and above error came , just make sure that all of your dependencies's Gradle are using same version of firebase servces and play service base.
For example :- my app level gradle file contains
compile "com.google.android.gms:play-services-base:11.4.0"
compile "com.google.firebase:firebase-core:11.4.0"
compile "com.google.firebase:firebase-messaging:11.4.0"
compile "com.google.firebase:firebase-analytics:11.4.0"
compile "com.google.firebase:firebase-crash:11.4.0"
compile "com.google.firebase:firebase-ads:11.4.0"
and one react-native library is using
compile "com.google.android.gms:play-services-base:11.8.0"
and other one library is using
compile "com.google.android.gms:play-services-base:+"
so what i did , i changed all services version to 11.8.0.
BTW you can see gradles of all libraries or dependencies when you open your react-native-project/android folder in Android studio
I hope this will solve your issue

ClassNotFoundException Mystery

Google Play Console is reporting a minute percentage of my users are getting a ClassNotFoundException upon app launch. The mystery is, which is the class that cannot be found? Well, the Stacktrace is supposed to state the name, but in these cases it is missing the name. The following is the trace, which is being sent by multiple devices:
java.lang.RuntimeException:
at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4720)
at android.app.ActivityThread.access$1500(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Method.java:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java:0)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
As you can see, the standard "Didn't find class "xx.yy.zz" message is missing!
Any ideas?
i just created an account to ask something so i couldn't help you by a comment:) sorry to make this little hint as an answer.
the last exception without a cause is the interesting one.
my answer despite the data you shared from your project is to look after the line "Caused by: java.lang.ClassNotFoundException:" in your log output, just below that line goto "BaseDexClassLoader.java:56" by clicking on it, it's the first line in its stack trace ,this line tells you the class and method where the exception with no cause occurred as well as its file and line number, i am pretty sure you will find more clues searching from there as that place is probably caused the main problem.

Android/Adobe air crash report: java.lang.UnsatisfiedLinkError

i am getting this error inside Google's "Crashes & ANRs". The application built with Adobe Air and packaged as captive runtime.
java.lang.UnsatisfiedLinkError: nativeSurfaceCreated
at com.adobe.air.AIRWindowSurfaceView.nativeSurfaceCreated(Native Method)
at com.adobe.air.AIRWindowSurfaceView.surfaceCreated(AIRWindowSurfaceView.java:719)
at android.view.SurfaceView.updateWindow(SurfaceView.java:545)
at android.view.SurfaceView.access$000(SurfaceView.java:81)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:693)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1731)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2583)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4508)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
Does anybody know what this means?
The UnsatisfiedLinkError for Java usually means that you tried to load a library called nativeSurfaceCreated. Basically your code called a method that called a method and so on, and some code somebody else wrote called a native method. This native method loaded a library called nativeSurfaceCreated, which you don't have. This is usually packaged in a dll in Windows or a so file in Linux. If you can find this dll/so file, you can probably run whatever you're running.

Categories