I added coreLibraryDesugaringEnabled to our app, and it works fine for normal app runs.
compileOptions {
coreLibraryDesugaringEnabled true
}
and
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
However, when I run a connected test it crashes with no such method error on the Stream class:
16:03:56.426 11998 12041 E AndroidRuntime: FATAL EXCEPTION: com....
16:03:56.426 11998 12041 E AndroidRuntime: Process: ...
16:03:56.426 11998 12041 E AndroidRuntime: java.lang.NoSuchMethodError: No static method e([Ljava/lang/Object;)Lj$/util/stream/Stream; in class Lj$/util/n; or its super classes (declaration of 'j$.util.n' appears in /data/app/com....-qU6nwXthxze4O_9rcf1hGg==/base.apk!classes2.dex)
16:03:56.426 11998 12041 E AndroidRuntime: at j$.util.stream.Stream$-CC.of(:1000)
16:03:56.426 11998 12041 E AndroidRuntime: at ...
I found some vague reference that this might be because the class is referenced prior to the call to Multidex.install? I'm first referencing the class as a static initializer so it is accessed very early. Not sure if this is a red herring but thought I'd mention it.
If it helps the tests are run with AndroidJUnit4ClassRunner.
EDIT: I found a vague reference, in only one article stating that this is not supported in instrumentation tests:
Please note in Android Studio 4.0 using these library desugared types
in instrumented tests is not supported.
https://medium.com/androiddevelopers/support-for-newer-java-language-apis-bca79fc8ef65
but even the embedded video from Google on the feature doesn't say anything about that. Also not sure what the AS version would have to do with it. Perhaps they meant the AGP version.
This problem was fixed in com.android.tools:desugar_jdk_libs version 1.1.8 (at least).
Related
I updated Android Studio till 4.1.1, i updated everything for launching emulator AVD on API 30,
but i get "No tests were found" when i'm trying to launch my UI-tests (Espresso framework) on that emulator.
In the same time i have no any problems with emulator 29 or below.
--------- beginning of crash
2020-11-24 18:04:31.036 24852-24852 E/AndroidRuntime: FATAL EXCEPTION: main
PID: 24852
java.lang.IllegalArgumentException: Wrong number of arguments; expected 6, got 3
at java.lang.reflect.Method.invoke(Native Method)
at androidx.test.services.speakeasy.client.ToolConnection$ToolConnectionPostIcs.doCall(ToolConnection.java:197)
at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:79)
at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:69)
at androidx.test.services.shellexecutor.BlockingPublish.getResult(BlockingPublish.java:74)
at androidx.test.services.shellexecutor.ShellCommandExecutorServer.start(ShellCommandExecutorServer.java:80)
at androidx.test.services.shellexecutor.ShellMain.main(ShellMain.java:45)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
2020-11-24 18:04:31.036 24852-24852 E/AndroidRuntime: Error reporting crash
java.lang.RuntimeException: Bad file descriptor
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:540)
at android.app.IActivityManager$Stub$Proxy.handleApplicationCrash(IActivityManager.java:5182)
at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:158)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.Thread.dispatchUncaughtException(Thread.java:2203)
2020-11-24 18:04:31.036 24852-24852 I/Process: Sending signal. PID: 24852 SIG: 9
Does anybody know what's the problem?
Thank a lot!
You should add permission WAKE_LOCK and increase androidx test orchestrator version. Also you should check actual versions for espresso core, rules and test runner.
I'm using the Starter SDK v3.13.2.8 to perform auto-suggest searches in an Android app. It works well on Android versions 9 and 4.2. But on Android 5.1.1 (API 22), the app crashes. Here's the stack trace:
11-01 16:24:09.022 341-430/com.example.myapp.debug E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
Process: com.example.myapp.debug, PID: 341
java.lang.NoSuchMethodError: No virtual method getActiveNetwork()Landroid/net/Network; in class Landroid/net/ConnectivityManager; or its super classes (declaration of 'android.net.ConnectivityManager' appears in /system/framework/framework.jar)
at a.a.a.a.a.v0.a(MapsUtils.java:23)
at a.a.a.a.a.v0.a(MapsUtils.java:20)
at a.a.a.a.a.h.e(AnalyticsTrackerExternal.java:6)
at a.a.a.a.a.h.d(AnalyticsTrackerExternal.java:1)
at a.a.a.a.a.h$c.run(AnalyticsTrackerExternal.java:50)
at a.a.a.a.a.h$i.run(AnalyticsTrackerExternal.java:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
In order for this exception to be thrown, I don't even need to dispatch the request. All I need to do is to initialize the map engine:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
MapEngine.getInstance().init(ApplicationContext(this)) {
Log.d("HereInit", "$it")
}
}
}
Before the app crashes, though, it's possible to see the log output from the MapEngine.init callback:
11-01 16:24:10.079 341-341/com.example.myapp.debug D/HereInit: NONE
Fix will be included in SDK 3.14 release. From all projects tab inside the portal, the new version which is 4.1 can be downloaded.
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.
I recently started getting this error in certain scenarios at run time in my app...
I have already tried the following :
Add proguard rules to include com.google.common.
Mutlidex rules so that all the classes get packaged in main dex file
I have checked the apk contents to make sure the classes are present in the dex file...
Updgraded my guava android lib to latest 27.0.0-android
Updated gradle plugin and gradle version to the latest
AndroidRuntime: java.lang.NoSuchMethodError: No static method
checkArgument(ZLjava/lang/String;I)V in class
Lcom/google/common/base/Preconditions; or its super classes
(declaration of 'com.google.common.base.Preconditions' appears in
/data/app/com.myapp.dev.test-Xip2SNDMljPc2_BN0p3iRg==/base.apk!classes2.dex)
03-26 13:49:19.167 14658 14751 E AndroidRuntime: at
com.google.common.util.concurrent.RateLimiter.checkPermits(RateLimiter.java:424)
03-26 13:49:19.167 14658 14751 E AndroidRuntime: at
com.google.common.util.concurrent.RateLimiter.tryAcquire(RateLimiter.java:341)
03-26 13:49:19.167 14658 14751 E AndroidRuntime: at
com.google.common.util.concurrent.RateLimiter.tryAcquire(RateLimiter.java:325)
Not sure where to go from here now. Any ideas what else can I do ?
Try to add below proguard configuration
-keep class com.google.common.base.**
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.