IncompatibleClassChangeError when called "realm.copyToRealmOrUpdate({RealmModel})" - android

when i call "realm.copyToRealmOrUpdate({RealmObject})", app crashes on lower API(21-25). No problem in version API-25 and above. Logcat output :
java.lang.IncompatibleClassChangeError: The method 'java.lang.Class java.lang.Object.getClass()' was expected to be of type interface but instead was found to be of type virtual (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at io.realm.DefaultRealmModuleMediator.copyOrUpdate(DefaultRealmModuleMediator.java:131)
at io.realm.Realm.copyOrUpdate(Realm.java:1815)
at io.realm.Realm.copyToRealmOrUpdate(Realm.java:1199)
at com.viyatek.ultimatefacts.Activites.MainActivity.DataFetched$lambda-10(MainActivity.kt:826)
at com.viyatek.ultimatefacts.Activites.MainActivity.$r8$lambda$fX_wkxDWKFkFuw4LXNz0m5YzJyo(MainActivity.kt)
at com.viyatek.ultimatefacts.Activites.MainActivity$$ExternalSyntheticLambda4.execute(D8$$SyntheticClass)
at io.realm.Realm.executeTransaction(Realm.java:1604)
at com.viyatek.ultimatefacts.Activites.MainActivity.DataFetched(MainActivity.kt:823)
at com.viyatek.ultimatefacts.NetworkOperations.getData.ExecuteNetWorkCall$lambda-0(getData.kt:111)
at com.viyatek.ultimatefacts.NetworkOperations.getData.$r8$lambda$Va8-rJSbrmVyGMKSedsNwZR74V8(getData.kt)
at com.viyatek.ultimatefacts.NetworkOperations.getData$$ExternalSyntheticLambda1.onResponse(D8$$SyntheticClass)
at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:100)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
i use in top-level gradle;
classpath "io.realm:realm-gradle-plugin:10.10.1"
I have no idea for the solution. I added try-catch block for now. I suspect ProGuard. but, for now i couldn't find the solution

Related

java.lang.IllegalStateException: Required view not found - butterknife not working sometimes

I'm getting following exception if sometimes thought of posting it after a month. Every time I have to delete build folder and error goes away. So it is risky to stay like this condition for long run, as sometimes developer might forget to check this activity is opening or not.
So far strangely it is only happening with one file ProductListActivity.kt
This runtime error looks like common error Is there a Gradle configurations needed to fix it.
How to completely get rid of it?
java.lang.RuntimeException: Unable to start activity ComponentInfo ProductDetails.activity.ProductListActivity}: java.lang.IllegalStateException: Required view 'name_text_box' with ID 2131362920 for method 'onNearbyClicked' was not found. If this view is optional add '#Nullable' (fields) or '#Optional' (methods) annotation.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.IllegalStateException: Required view 'name_text_box' with ID 2131362920 for method 'onNearbyClicked' was not found. If this view is optional add '#Nullable' (fields) or '#Optional' (methods) annotation.
at butterknife.internal.Utils.findRequiredView(Utils.java:88)
at ProductDetails.activity.ProductListActivity_ViewBinding.<init>(ProductListActivity_ViewBinding.java:27)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at butterknife.ButterKnife.bind(ButterKnife.java:170)
at butterknife.ButterKnife.bind(ButterKnife.java:99)
at common.BaseActivity.setContentView(BaseActivity.java:51)
at ProductDetails.activity.ProductListActivity.onCreate(ProductListActivity.kt:220)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at and
What i can see from the logs that you are using kotlin, so instead of butterknife you can replace your code with view binding(area which are getting error)
https://kotlinlang.org/docs/tutorials/android-plugin.html

Issue: java.lang.NoSuchMethodError: No static method printStackTrace(Ljava/lang/Throwable;) in Google playstore

I am getting pre launch report in my playstore as this:
Error Log -
java.lang.NoSuchMethodError: No static method printStackTrace(Ljava/lang/Throwable;)V in class Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension; or its super classes (declaration of 'com.google.devtools.build.android.desugar.runtime.ThrowableExtension' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
FATAL EXCEPTION: ControllerMessenger
Process: com.veblr.videomate, PID: 17578
java.lang.NoSuchMethodError: No static method printStackTrace(Ljava/lang/Throwable;)V in class Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension; or its super classes (declaration of 'com.google.devtools.build.android.desugar.runtime.ThrowableExtension' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
at com.veblr.videomate.SpashScreenActiviy.updateAndroidSecurityProvider(Unknown Source)
at com.veblr.videomate.VideoPlayerActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:6013)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.support.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:667)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
at android.app.ActivityThread.access$1200(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.support.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:148)
at android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:466)
at android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:420)
at android.support.test.espresso.base.UiControllerImpl.injectMotionEvent(UiControllerImpl.java:234)
at android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:140)
at android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:123)
at android.support.test.espresso.action.Tap.sendSingleTap(Tap.java:170)
at android.support.test.espresso.action.Tap.access$100(Tap.java:31)
at android.support.test.espresso.action.Tap$1.sendTap(Tap.java:46)
at android.support.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:136)
at android.support.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:355)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:242)
at android.support.test.espresso.ViewInteraction.access$100(ViewInteraction.java:62)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:149)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:146)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
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:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
This is my logcat which is showing inthe report.
I can not find out what the problem is with my app.
This is the device in which the error is showing :
Apparently there's at least someone else experiencing the same issue as yours: App crash due to not found exception method printStateTrace in Android issue tracker.
Maybe if you can provide additional information they will be able to investigate the issue.
Another similar issue was because of a bug in Gradle plugin, so maybe you can try to update it.

Volley Request status is false and response is null in Android when press the Back button

I am getting the false status while hitting the api by using the Volley library. I tried to debug the code many times but I did not understand where I'm doing wrong; seems like I am passing the params and everything fine.
I got the below error.
java.lang.NullPointerException: Attempt to read from field 'byte[] com.android.volley.NetworkResponse.data' on a null object reference
at com.pcnc.bop.helpers.VolleyRequest$2.onErrorResponse(VolleyRequest.java:98)
at com.android.volley.Request.deliverError(Request.java:577)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:101)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Instabug Attempt to invoke virtual method 'void android.app.Dialog.dismiss()' on a null object reference

Getting crashes inside Instabug on Android app. This is from the store version of the app so I do not have steps to reproduce. Thank you!
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Dialog.dismiss()' on a null object reference
at com.instabug.library.m.c(InstabugDelegate.java:455)
at com.instabug.library.activity.a.onClick(InstabugInvocationDialog.java:99)
at android.view.View.performClick(View.java:5254)
at android.view.View$PerformClick.run(View.java:21179)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
This bug should be solved in later versions.
Can you try out v2.3.1 and tell me how it goes?
This issue has been solved since version 3.0.5.
You just need to upgrade to latest version >= v3.0.5

Unknown Source when I use Proguard

My crash report is a little bit useless if I use Proguard (minifyEnabled true and shrinkResources true)
This is the report with Proguard:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ProgressBar.setVisibility(int)' on a null object reference
at xx.xxxx.xxx.xxxxx.xxxxxx.restoreViewAfterLoading(Unknown Source)
at xx.xxxx.xxx.xxxxx.xxxxxx.newInstance(Unknown Source)
onCreateView
onViewCreated
access$000
at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(Unknown Source)
at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(Unknown Source)
at retrofit.CallbackRunnable$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
And this is the normal report without Proguard:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ProgressBar.setVisibility(int)' on a null object reference
at xx.xxxx.xxx.xxxxx.xxxxxx.restoreViewAfterLoading(xxxxxx.java:123)
at xx.xxxx.xxx.xxxxx.xxxxxx.access$000(xxxxxx.java:26)
at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(xxxxxx.java:96)
at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(xxxxxx.java:92)
at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:45)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Is there something I can do to get line numbers with Proguard?
Looks like you have a NPE in some file in the method called restoreViewAfterLoading where setVisibility is called on a ProgressBar (which is null) around line 123 of some file. This all happens on a retrofit callback. So my first thoughts to fix is to check for null in case the user has finished this activity/fragment.
to get better line numbering, Add the following to your proguard configuration
# Preserve annotations, line numbers, and source file names
-keepattributes *Annotation*,SourceFile,LineNumberTable
This will preserve line numbers in obfuscated stack traces.
HTHs

Categories

Resources