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

Compiling Firestore with AGP 8.0 cause an R8 issue #4974

Closed
Lyokone opened this issue May 3, 2023 · 6 comments
Closed

Compiling Firestore with AGP 8.0 cause an R8 issue #4974

Lyokone opened this issue May 3, 2023 · 6 comments
Assignees

Comments

@Lyokone
Copy link

Lyokone commented May 3, 2023

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 2022.2.1
  • Firebase Component: Firestore
  • Component version: 32.0.0

[REQUIRED] Step 3: Describe the problem

When trying to compile an application using Gradle 8.0 with Firestore I get the following issue:

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in PATH/build/app/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class org.kxml2.io.KXmlParser,org.kxml2.io.KXmlSerializer (referenced from: java.lang.Iterable io.grpc.ServiceProviders.getCandidatesViaServiceLoader(java.lang.Class, java.lang.ClassLoader) and 1 other context)

Steps to reproduce:

Switch to AGP 8.0.

@dconeybe
Copy link
Contributor

dconeybe commented May 3, 2023

Hi @Lyokone. I'll take a look at this.

@Lyokone
Copy link
Author

Lyokone commented May 4, 2023

Thanks, doing more experiments around migrating all the example apps from FlutterFire, I found similar issues for

  • Performance
    ERROR: R8: Missing class org.kxml2.io.KXmlParser,org.kxml2.io.KXmlSerializer (referenced from: java.util.List kotlinx.coroutines.internal.FastServiceLoader.load(java.lang.Class, java.lang.ClassLoader))
  • Database
    ERROR: R8: Missing class org.kxml2.io.KXmlParser,org.kxml2.io.KXmlSerializer (referenced from: java.util.List kotlinx.coroutines.internal.FastServiceLoader.load(java.lang.Class, java.lang.ClassLoader))

@dconeybe
Copy link
Contributor

dconeybe commented May 4, 2023

I just tried a vanilla android project with agp8 and it worked just fine: https://github.com/dconeybe/agp8testapp
Can you try out that application? Just run ./gradlew assembleDebug

@Lyokone
Copy link
Author

Lyokone commented May 5, 2023

I've tried on your project and it works as expected in release and debug mode, with minifyEnabled true and shrinkResources true
Not sure why it wouldn't work on Flutter but at least I know where the problem is 😅

Thanks for your help, I think we can close this

@Lyokone Lyokone closed this as completed May 5, 2023
@Lyokone
Copy link
Author

Lyokone commented May 5, 2023

For reference: after some more investigation, it seems that adding the

  integration_test:
    sdk: flutter

is what is causing the R8 errors. Till integration_test is not fully updated user should stay on 7.4.2.

@cuong0993
Copy link

Raised flutter/flutter#127388

@firebase firebase locked and limited conversation to collaborators Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants