I have checked all the questions raised in SO like this and i couldn't find answer to my issue.
We had an app in PlayStore which is developed in Xamarin.Android with code shared with Xamarin.iOS via Shared Project.
Now we are switching to Xamarin.Forms. We have changed ,
Some UI
Login mechanism with AutoLogin based on Token stored in local device.
The app working fine in Devices and Simulators.
We have uploaded our app to playstore. If the user have old version in their device, after update the app crashing after showing splashscreen for few seconds.
If we uninstall the old version, it is working fine.
Error in google console:
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2955)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java030)
at android.app.ActivityThread.-wrap11 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6938)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java27)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.ClassCastException:
at android.app.SharedPreferencesImpl.getLong (SharedPreferencesImpl.java:279)
at md56c96bd185bfbb3ebebdd94ef17444e8f.MainActivity.n_onCreate (Native Method)
at md56c96bd185bfbb3ebebdd94ef17444e8f.MainActivity.onCreate (MainActivity.java1)
at android.app.Activity.performCreate (Activity.java:7174)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2908)
We are not sure why this is happening. Can any one let me know, why this happening and how to prevent it. Also, is it possible reproduce this issue in VisualStudio?
Thanks
Probably your SharedPreferences parameters have incompatible types. And I didn't found a proof that it could be xamarin.Forms problem. If you look at the source code SharedPreferencesImpl.java to the getLong method you will see the following cast:
Long v = (Long)mMap.get(key);
This means that on old versions there was parameter with the same name but with type different from Long. You read this parameter in onCreate method of your MainActivity, but parameter type is incompatible.
Related
I am using MSAL for Android and confused about this error:
com.microsoft.identity.common.java.exception.ServiceException: Invalid JSON 'claims' value encountered
at com.microsoft.identity.common.java.controllers.ExceptionAdapter.exceptionFromAcquireTokenResult(ExceptionAdapter.java:96)
at com.microsoft.identity.common.java.controllers.CommandDispatcher.getCommandResultFromTokenResult(CommandDispatcher.java:572)
at com.microsoft.identity.common.java.controllers.CommandDispatcher.executeCommand(CommandDispatcher.java:480)
at com.microsoft.identity.common.java.controllers.CommandDispatcher.access$100(CommandDispatcher.java:85)
at com.microsoft.identity.common.java.controllers.CommandDispatcher$5.run(CommandDispatcher.java:648)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
Caused by: com.microsoft.identity.client.exception.MsalServiceException: Invalid JSON 'claims' value encountered
at com.microsoft.identity.client.internal.controllers.MsalExceptionAdapter.msalExceptionFromBaseException(MsalExceptionAdapter.java:74)
at com.microsoft.identity.client.SingleAccountPublicClientApplication$3.onError(SingleAccountPublicClientApplication.java:351)
at com.microsoft.identity.client.SingleAccountPublicClientApplication$3.onError(SingleAccountPublicClientApplication.java:337)
at com.microsoft.identity.common.java.controllers.CommandDispatcher.commandCallbackOnError(CommandDispatcher.java:534)
at com.microsoft.identity.common.java.controllers.CommandDispatcher.access$1000(CommandDispatcher.java:85)
at com.microsoft.identity.common.java.controllers.CommandDispatcher$4.run(CommandDispatcher.java:514)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
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)
how to fix this com.microsoft.identity.client.exception.MsalServiceException?
In my case it was an expired Azure Subscription. The free trial has ended and I had to upgrade to pay as you go subscription.
Go to Cost Management in Azure Portal and check for red boxes or warnings and fix them.
I detected today the same issue, without any change on the code, I get now the error message. The LogIn screen is shown, I can indicate user and password, but then I get the same exception.
I renewed already the app registration in Azure, but no solution.
Did you change anything in your app before? Or did you add any new library?
I'm having a crash in a Xamarin.Android App, but this ONLY happens in RELEASE mode.
The issue is when accesing the map. So, I've extracted the device log and after analyzed it, I've found these lines:
03-19 19:55:10.305 HUAWEI JKM-LX3 Error 14753 AndroidRuntime java.lang.NoSuchFieldError: no "Lcom/google/android/gms/location/SettingsApi;" field "SettingsApi" in class "Lcom/google/android/gms/location/LocationServices;" or its superclasses
at mono.android.content.DialogInterface_OnClickListenerImplementor.n_onClick(Native Method)
at mono.android.content.DialogInterface_OnClickListenerImplementor.onClick(Unknown Source:0)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:174)
at android.os.Handler.dispatchMessage(Handler.java:112)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
03-19 19:55:10.305 HUAWEI JKM-LX3 Error 14753 AndroidRuntime Process: com.companyname.app, PID: 14753
03-19 19:55:10.305 HUAWEI JKM-LX3 Error 14753 AndroidRuntime FATAL EXCEPTION: main
After a few google searches, I've found this answer, but it comes from 2018, and it's not related to Xamarin. One of the comments says that "Google just deprecated GoogleApiCLient" in 2018.
Another resource I've found is this one which, kinda seems familiar, but it comes from a plugin repo in github. A user says that he had to reverse to 1.5.7, but what package is he talking about?
Again, this happens only in RELEASE mode, for Google Play. In DEBUG mode the maps works fine, no problem at all.
If you require more data, just tell me.
Thanks for your help.
I have an active app on Google Play. My users are often experiencing a crash that I can't figure out where to debug.
java.lang.NoClassDefFoundError:
at jl.b (jl.java:3)
at jk.a (jk.java:3)
at jm.a (jm.java:18)
at com.google.android.gms.ads.internal.util.ap.a (ap.java:17)
at ip.a (ip.java:19)
at ip.run (ip.java:8)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ac.loadClass (ac.java:4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
at jl.b (jl.java:3)
at jk.a (jk.java:3)
at jm.a (jm.java:18)
at com.google.android.gms.ads.internal.util.ap.a (ap.java:17)
at ip.a (ip.java:19)
at ip.run (ip.java:8)
The last portion makes me think it's related to AdMob
at com.google.android.gms.ads.internal.util.ap.a (ap.java:17)
But I can't figure out where's exactly the problem. Everything on my test devices seem to be fine, but still other users are experiencing these crashes.
I've uploaded the de-obfuscator file, but these stack traces are all obfuscated.
I'm currently using the version 16.0.0 of play services ads
implementation 'com.google.android.gms:play-services-ads:16.0.0'
It appears there's a temporary workaround while we wait for this to be officially fixed from Google. Maps library is also affected.
Just put this tag into the Manifest file:
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
I tried it and it appears to be working. I'm going to mark this as an answer but I'll update this post when an official fix will be available.
As you say this is almost certainly an AdMob problem. They might be aware of it already, but with this sort of issue it is good to contact AdMob customer support, and then they can route the issue to the AdMob developers. It is very unlikely to be your fault.
You could do this on this page or in this form or
I'm working on Xamarin with Google Analytics ( 29.0.0.2 ), my Minimum Android Version is 4.2 and Target Android Version 5.0 the Target Framework is 5.0.
Everything works fine when i'm in Debug and when i distribute my release app on Dropbox and Airdroid, but, when i put my app on Google Play Console Beta, at first installation, Google Analytics Crash with this error:
java.lang.RuntimeException: Unable to instantiate receiver com.google.analytics.tracking.android.CampaignTrackingReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.analytics.tracking.android.CampaignTrackingReceiver" on path: DexPathList[[zip file "/data/app/it.riciclario.app-1/base.apk"],nativeLibraryDirectories=[/data/app/it.riciclario.app-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2587)
at android.app.ActivityThread.access$1700(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
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:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.analytics.tracking.android.CampaignTrackingReceiver" on path: DexPathList[[zip file "/data/app/it.riciclario.app-1/base.apk"],nativeLibraryDirectories=[/data/app/it.riciclario.app-1/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.ActivityThread.handleReceiver(ActivityThread.java:2582)
... 9 more
Suppressed: java.lang.ClassNotFoundException: com.google.analytics.tracking.android.CampaignTrackingReceiver
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)
... 11 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I can't understand where is the problem and i don't know what the hell it's append. When the App crash the first time, the second time everything works fine. I've this problem ONLY ON GOOGLE PLAY STORE not in debug, not with dropbox release or Airdroid installation.. No crash, no errors on my Android Monitor Tool.
Any idea? Thanks a lot.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.analytics.tracking.android.CampaignTrackingReceiver"
The CampaignTrackingReceiver intent (with com.android.vending.INSTALL_REFERRER) will be called when the app is installed from the Play Store.
Note: There are three different "class" locations for CampaignTrackingReceiver depending upon the version (v2/v3/v4) you are using. (Personally I am only using v4+ now due to various issues in earlier releases)
Is your manifest correct? If you can live without the install referer tracking, remove the receiver from your app's manifest.
Do you have Proguard enabled and not whitelisting com.google.analytics.* and thus are stripping the classes
Do you have other Google Play Services installed? Game, Location, etc.. as there are naming conflicts between some of those and Analytics. V2 and V3 both have problems related to this and different packages. It was finally corrected in V4. Know fixes for V2 and V3 are to manually edit the Google .jars (Google search is your friend for this...)
I'm seeing occasional crashes from my apps on the watch that give the following stack trace:
FATAL EXCEPTION: main
Process: com.mypackagename, PID: 3487
android.content.ReceiverCallNotAllowedException: BroadcastReceiver components are not allowed to register to receive intents
at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:179)
at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:168)
at com.google.android.gms.common.api.s.a(Unknown Source)
at com.google.android.gms.internal.j.a(Unknown Source)
at com.google.android.gms.internal.e.handleMessage(Unknown Source)
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)
Although the crash is reported from my app, you can see from the tracs that none of the code is mine - it's all GMS and platform code.
In other words, I understand the nature of the error, but it's not in my power to fix it. My app does use BroadcastReceivers, but I don't register any Intent handlers in them.
A solution to this would be great, but I'm also posting it here in the hopes that someone from the Wear platform team might see it. Wear platform bugs I've posted to the Android issue tracker get closed with a status of "wrong forum" (such as https://code.google.com/p/android/issues/detail?id=95740).