Closed mahdi-malv closed 2 years ago
This issue happens with admob:20.4.0
or earlier.
Quick solution: Update to 20.5.0
or 20.6.0
. TapsellPlus is compatible with both.
Solution 2: add this in build.gradle
implementation("androidx.work:work-runtime:2.7.0")
From Admob releasenote:
This release and all previous versions require an explicit dependency on androidx.work:work-runtime:2.7.0 to fix a bug causing app crashes on Android S with the following stack trace:
Fatal Exception: java.lang.IllegalArgumentException:
com.mycompany.myapp: Targeting S+ (version 10000 and above)
requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be
specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE
if some functionality depends on the PendingIntent being mutable,
e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:386)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:657)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:644)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75)
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)
To fix this bug, add the following dependencies for the Google Mobile Ads SDK to your module's app-level Gradle file:
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.4.0'
// For apps targeting Android 12, add WorkManager dependency.
constraints {
implementation('androidx.work:work-runtime:2.7.0') {
because '''androidx.work:work-runtime:2.1.0 pulled from
play-services-ads has a bug using PendingIntent without
FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in Apps
targeting S+.'''
}
}
}
Issue fully fixed in 2.1.7
I have addeddependency androidx.work:work-runtime:2.7.1 but it did not works it crashes everytime can you suggest better idea to avoid below mentioned issue ?
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 11-07 14:20:13.906 15697 15911 E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.app.PendingIntent.checkFlags(PendingIntent.java:375) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.app.PendingIntent.getActivity(PendingIntent.java:444) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.app.PendingIntent.getActivity(PendingIntent.java:408) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.GoogleApiAvailabilityLight.getErrorResolutionPendingIntent(Unknown Source:10) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.GoogleApiAvailabilityLight.getErrorResolutionPendingIntent(Unknown Source:1) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.GoogleApiAvailability.getErrorResolutionPendingIntent(Unknown Source:0) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.GoogleApiAvailability.getErrorResolutionPendingIntent(Unknown Source:16) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.GoogleApiAvailability.zaa(Unknown Source:0) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.api.internal.GoogleApiManager.zac(Unknown Source:4) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.api.internal.GoogleApiManager$zaa.onConnectionFailed(Unknown Source:68) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.api.internal.GoogleApiManager$zaa.connect(Unknown Source:52) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.api.internal.GoogleApiManager$zaa.zaa(Unknown Source:54) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.common.api.internal.GoogleApiManager.handleMessage(Unknown Source:538) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at com.google.android.gms.internal.base.zap.dispatchMessage(Unknown Source:0) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:210) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.os.Looper.loop(Looper.java:299) 11-07 14:20:13.906 15697 15911 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67)
any solution ?
if anyone wants a solution related to unity3d add this line in mainTemplate.gradle file
Describe the issue: Happens when launching the app. App crashes immediately.
Paste the error text in your logs:
[Optionally paste the whole stacktrace for more details:
How to reproduce this issue:
Add
admob
and run the sample or any appApp package name:
Not important