Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash when target Android SDK 31 #709

Closed
mattking-chip opened this issue Sep 23, 2021 · 7 comments
Closed

App crash when target Android SDK 31 #709

mattking-chip opened this issue Sep 23, 2021 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mattking-chip
Copy link

Describe what happened
When changing targetSdk and compileSdk to 31, including the dd-sdk-android dependency will cause a crash at startup:

    java.lang.IllegalArgumentException: [REDACTED]: Targeting S+ (version 31 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:375)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
        at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:196)
        at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:128)
        at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:93)
        at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
        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)

Steps to reproduce the issue:

Change targetSdk and compileSdk to 31

Describe what you expected:

App runs without crash

Possible fixes
Including a dependency to androidx.work:work-runtime:2.7.0-beta01 the problem goes away, so it appears a dependency of dd-sdk-android needs updating.

Additional context

  • Android OS version: Android S (SDK 31)
  • Device Model: Any
  • Datadog SDK version: 1.10.0
@mattking-chip mattking-chip added the bug Something isn't working label Sep 23, 2021
@mariusc83 mariusc83 self-assigned this Sep 27, 2021
@mariusc83 mariusc83 pinned this issue Sep 27, 2021
@mariusc83
Copy link
Collaborator

Hi @mattking-chip,

Thank you very much for taking the time to explain and post this issue. We are indeed aware of this crash but unfortunately because the android work-runtime API is still in beta we are not going to make yet a release with this hotfix. What we propose instead in order to mitigate this issue for now is to force the usage of 2.7.0-beta01 version in your build.gradle resolution strategy:

configurations.all {
    resolutionStrategy {
        force("androidx.work:work-runtime:2.7.0-beta01")
    }
}

Once a stable version will be released by Google we will publish a new version of the Datadog SDK pointing to the latest version of work-runtime API.

@ribafish
Copy link

ribafish commented Nov 5, 2021

Note: Androidx WorkManager is now stable at 2.7.0 🎉

@xgouchet
Copy link
Collaborator

xgouchet commented Nov 5, 2021

Thanks a lot @ribafish , we're upgrading our dependencies as we speak, this will be solved in a future version.

@xgouchet xgouchet added this to the 1.12.0 milestone Nov 24, 2021
@pvegh
Copy link

pvegh commented Jan 4, 2022

Could this be prioritised as a patch release? We can't target 31 and we're blocked by this.

@xgouchet
Copy link
Collaborator

xgouchet commented Jan 4, 2022

Hi @pvegh , did you try Marius's fix above :

configurations.all {
    resolutionStrategy {
        force("androidx.work:work-runtime:2.7.0")
    }
}

@pvegh
Copy link

pvegh commented Jan 4, 2022

Hi, thanks but that would be a technical debt. Fixing a problem today but needing to act on it later. Possibly forgetting why it's there, so commenting it and all that. We are paying customers (not even that small) and would like correct and timely updates in these cases. Hope you can understand our standpoint :)

@xgouchet
Copy link
Collaborator

xgouchet commented Jan 6, 2022

Hi @pvegh , we made a hotfix and released it, version 1.11.1. Let us know if you have any other issue with the SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants