app crashes on production but not in development - android app - android

My Project structure:
1- Kotlin app lib.
2-Java app calling methods from Kotlin lib.
From Java app I'm calling some methods from Kotlin lib. in development all works good and methods called successfully. after generating apk app starts with splash screen then crashes after getting location,
specifically when calling methods from Kotlin lib.
I think I missed something when generating apk with App and lib.
I tried this example and another about proguardFiles but no new result:
https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/
the error:
2020-05-28 13:22:29.970 339-339/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.app, PID: 339
java.lang.NoSuchMethodError: No static method asAttributeSet(Lh/a/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar:classes2.dex)
at c.a.n.g.inflate()
at ui.activity.MainActivity.onCreateOptionsMenu()
at android.app.Activity.onCreatePanelMenu(Activity.java:3183)
at androidx.fragment.app.d.onCreatePanelMenu()
at c.a.n.i.onCreatePanelMenu()
at androidx.appcompat.app.f$j.onCreatePanelMenu()
at c.a.n.i.onCreatePanelMenu()
at androidx.appcompat.app.i.o()
at androidx.appcompat.app.i$a.run()
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Related

Appsflyer Crash : Fatal Exception: java.lang.NoSuchMethodError for MultipleInstallBroadcastReceiver.java line 43

I am getting a Crash which is reported in Crashlytics for com.appsflyer.MultipleInstallBroadcastReceiver.onReceive in MultipleInstallBroadcastReceiver.java class
This Crash is been reported for few users in all the android verisons
Fatal Exception: java.lang.NoSuchMethodError: No virtual method 藡(Landroid/content/Context;Landroid/content/Intent;)V in class Lcom/appsflyer/AppsFlyerLib; or its super classes (declaration of 'com.appsflyer.AppsFlyerLib' appears in /data/app/com.rapido.passenger-1/base.apk)
at com.appsflyer.MultipleInstallBroadcastReceiver.onReceive(MultipleInstallBroadcastReceiver.java:43)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3112)
at android.app.ActivityThread.-wrap18(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1627)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:165)
at android.app.ActivityThread.main(ActivityThread.java:6375)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
From the stack trace it seems to be an obfuscation issue (looking at the method name 藡)
What is the SDK version being used? Are there any proGuard (or other tool) rules configured for AppsFlyer?
If not I would suggest adding a -keep class com.appsflyer.** { *; } rule.
If you do not wish to share any additional information publicly, you can open a ticket with support#appsflyer.com, with the SDK version, any obfuscation related information and a link to this thread.

Try send message to test if FCM works but the app crash

Trying to build a Firebase chat app and wanted to test if FCM works. Tried testing the notification function by sending a cloud messaging from the firebase console but the app crash in all the devices.
This is the error retrive from the logcat
06-30 16:11:07.783 26794-26794/com.example.ryzeng.firebasechat
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ryzeng.firebasechat, PID: 26794
java.lang.NoSuchMethodError: No static method zzad()Lcom/google/firebase/iid/zzan; in class
Lcom/google/firebase/iid/zzan; or its super classes (declaration of
'com.google.firebase.iid.zzan' appears in
/data/app/com.example.ryzeng.firebasechat-2/split_lib_dependencies_apk.apk)
at com.google.firebase.messaging.FirebaseMessagingService.zzb(Unknown
Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3366)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1612)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6236)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
In your project files , in file build.gradle ("Module: app")
change version of firebase messaging to last version like :
implementation 'com.google.firebase:firebase-messaging:20.1.4'
Work for me
When i Update firebase messaging dependency
from
implementation 'com.google.firebase:firebase-messaging:17.0.0'
to
implementation 'com.google.firebase:firebase-messaging:17.3.1'
It happens when you implement 2 or more Firebase with different versions.
So it's better to give same version to all firebase's implementation.
implementation 'com.google.firebase:firebase-ads:17.1.3'

Android libraries not exact version?

so i'm making an app which can upload an image to the server, the web service is good and running and tested with postman.
on The application side, when i tried to add the implementation of the upload service 3.4.2 it's showing me an error, and the app is crashing at the moment of the upload.
here is a screenshot i'm new and not allowed to add pictures,https://i.stack.imgur.com/s3s8x.png
i need fast help please.
here is the run error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.simou.myapplication, PID: 5205
java.lang.RuntimeException: Unable to start service net.gotev.uploadservice.UploadService#c425f01 with Intent { act=net.gotev.uploadservice.action.upload cmp=com.simou.myapplication/net.gotev.uploadservice.UploadService (has extras) }: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3314)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1565)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at net.gotev.uploadservice.UploadService.onStartCommand(UploadService.java:257)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3297)
As mentioned in the error you need to set the namespace for your application as privided the library's wiki
public class Initializer extends Application {
#Override
public void onCreate() {
super.onCreate();
// setup the broadcast action namespace string which will
// be used to notify upload status.
// Gradle automatically generates proper variable as below.
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
// Or, you can define it manually.
UploadService.NAMESPACE = "com.yourcompany.yourapp";
}
}
and register it to your manifest
<application
android:name=".Initializer"
...
>

FATAL EXCEPTION: GoogleApiHandler

In my project i'm using the monetization service(Vungle/AppLovin).
When I'm trying to load an ad, i get this exception
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
Process: kz.ikar, PID: 3673
java.lang.NoSuchMethodError: No virtual method setChannelId(Ljava/lang/String;)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/kz.ikar-2oCl4DY4J8w7wP-jirbYvA==/split_lib_dependencies_apk.apk)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:225)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:15)
at com.google.android.gms.common.api.internal.zzbm.zzc(Unknown Source:4)
at com.google.android.gms.common.api.internal.zzbo.onConnectionFailed(Unknown Source:104)
at com.google.android.gms.common.api.internal.zzbo.connect(Unknown Source:83)
at com.google.android.gms.common.api.internal.zzbo.zza(Unknown Source:47)
at com.google.android.gms.common.api.internal.zzbm.handleMessage(Unknown Source:283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
In my project I have two fragments in one activity. The user gets an ad in the second one. If I load an ad from the activity, it works well. What can be the cause of this issue?
By the way both ad networks(Vungle and AppLovin) return this exception
I had the same problem and I fixed it downgrading to firebase Google Play services 11.6.0
One reason you could be getting this error is if your buildToolsVersion in your app-level Gradle is less than 26. Either that or your v4 support is less than 26.0.0 seeing as NotificationCompat.Builder was added in API 26.

NoSuchMethodError after including two libraries using ProGuard

I'm trying to include two libraries (panframe and indoo.rs) into my Android project using Gradle 2.1.2. Both were using ProGuard presumably to obfuscate their private methods. Since both libs use the same obfuscation pattern, a call to a static method from the indoo.rs worker service in onBind() leads to an ambiguity for the ClassLoader:
java.lang.NoSuchMethodError: No static method a(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/a/a/a/g; or its super classes (declaration of 'com.a.a.a.g' appears in /data/data/com.companytest/files/instant-run/dex/slice-panframe-1.9_e8c65b231b25083f170d9dc622b9f9f514e9ecef-classes.dex)
at com.a.a.h.a.j$a.(SourceFile:449)
at com.a.a.h.a.j.a(SourceFile:411)
at com.customlbs.service.Worker.onBind(SourceFile:184)
at android.app.ActivityThread.handleBindService(ActivityThread.java:3834)
at android.app.ActivityThread.access$2200(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Apart from not obfuscating com.a.a.h.a.j.a in the indoo.rs library, is there any method to prevent this?

Categories

Resources