Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: [Android] Release build crashes on launch with AGP 9: R8 removes WorkDatabase_Impl constructor (Room 2.6.1 keep rule)

Open Beginner friendly
#1,724 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, dart, flutter, kotlin
Domain
mobile

Research direction

Start by reading the plugin’s Android proguard-rules.pro and checking how its rules are included in the release build. Reproduce with AGP 9 and minification enabled, then confirm the Room WorkDatabase_Impl constructor is retained in the R8 output. Done when the release app launches successfully with the keep rule in place.

Written by the indexing model from the issue text.

Description

bug
Required Reading
  • Confirmed
Plugin Version

5.8.0

Flutter Doctor
[✓] Flutter (Channel stable, 3.47.6, on macOS 26.6.2 25G83 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    ! Multiple adb binaries found.
    ! Some Android licenses not accepted.
[!] Xcode - develop for iOS and macOS (Xcode 27.0)
    ! iOS 27.0 Simulator not installed.
[✓] Chrome - develop for the web
[✓] Connected device (6 available)
[✓] Network resources

Android Gradle Plugin 9.4.0, Gradle 9.6.0, Kotlin 2.3.20
Mobile operating-system(s)
  • iOS
  • Android
Device Manufacturer(s) and Model(s)

Google Pixel 9 Pro (emulator); affects every device

Device operating-systems(s)

Android 17

What happened?

With Android Gradle Plugin 9 and minifyEnabled, our release build crashes on launch, before Flutter starts. Debug builds are fine.

R8 removes the no-arg constructor of androidx.work.impl.WorkDatabase_Impl. Room creates that class by reflection, so androidx.startup fails to initialize WorkManager (see log output).

Dependency chain:

com.transistorsoft:tslocationmanager:4.6.4   (also 4.7.6, the latest)
\--- androidx.work:work-runtime:2.10.0
     \--- androidx.room:room-runtime:2.6.1

Room 2.6.1 ships only -keep class * extends androidx.room.RoomDatabase. With AGP 9, R8 no longer keeps the default constructor for a class-only -keep rule (android.r8.strictFullModeForKeepRules is on by default). Room 2.7 fixed this in its own consumer rules ({ void <init>(); }). WorkManager 2.11+ depends on Room 2.7, but tslocationmanager still pins work-runtime:2.10.0.

R8's usage.txt confirms the removal:

androidx.work.impl.WorkDatabase_Impl:
    public void <init>()

Expected: a release build with AGP 9 starts normally.

Suggested fix: add this rule to the plugin's android/proguard-rules.pro (or the SDK's consumer rules). It is the same rule Room 2.7 ships:

-keep class * extends androidx.room.RoomDatabase { void <init>(); }

We added it to our app's proguard-rules.pro and the release build starts again. Upgrading to work-runtime 2.11+ would also fix it, but I saw in #1622 that it requires a higher compileSdk.

Plugin Code and/or Config
// Not plugin config: release build type in android/app/build.gradle.kts
release {
    isMinifyEnabled = true
    isShrinkResources = false
    proguardFiles(
        file("${backgroundGeolocation.projectDir}/proguard-rules.pro"),
        file("proguard-rules.pro"),
    )
}
Relevant log output
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider
E AndroidRuntime:     at android.app.ActivityThread.installProvider(ActivityThread.java:9191)
E AndroidRuntime:     at android.app.ActivityThread.installContentProviders(ActivityThread.java:8668)
E AndroidRuntime:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:8293)
E AndroidRuntime:     ...
E AndroidRuntime: Caused by: lv3: java.lang.NoSuchMethodException: androidx.work.impl.WorkDatabase_Impl.<init> []
E AndroidRuntime:     at pf.b(r8-map-id-1c2fcce569c11920677ba238b5dacd04c72d330822c128ef38e423dbeb5cd5b6:104)
E AndroidRuntime:     at pf.a(r8-map-id-1c2fcce569c11920677ba238b5dacd04c72d330822c128ef38e423dbeb5cd5b6:86)
E AndroidRuntime:     at androidx.startup.InitializationProvider.onCreate(r8-map-id-1c2fcce569c11920677ba238b5dacd04c72d330822c128ef38e423dbeb5cd5b6:55)
E AndroidRuntime:     at android.content.ContentProvider.attachInfo(ContentProvider.java:2695)
Dominant language
Dart
Stars
732
Forks
287
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from transistorsoft/flutter_background_geolocation

All issues in transistorsoft/flutter_background_geolocation

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.