firebase-android-sdk: Firebase Performance Monitoring fails on build

[READ] Step 1: Are you in the right place?

I’m reporting an issue on a Firebase SDK, I guess so.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.0, 4.1, 4.2 Preview
  • Firebase Component: Firebase Performance Monitoring
  • Component version: 19.0.8

[REQUIRED] Step 3: Describe the problem

When building the project with the Android Gradle Plugin 4.0 or + always fails:

Caused by: java.lang.IllegalStateException: Unexpected non-class file: META-INF\versions\9\org\junit\platform\commons\util\ModuleUtils$ModuleReferenceScanner.class

After a research I found some people opening questions on StackOverflow about the same topic and the only way to solve is to remove the Firebase Monitoring Library from the project

Example

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 25
  • Comments: 26 (1 by maintainers)

Most upvoted comments

I’m having a common issue, after updating to Kotlin 1.4.0, issue does not happen on 1.3.72:

Caused by: org.gradle.tooling.BuildException:
    Failed to process: 
        /bitrise/src/app/build/intermediates/transforms/FirebasePerformancePlugin/debug/0
Caused by: java.lang.IllegalStateException: 
    Unexpected non-class file: 
        META-INF/versions/9/kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class

Configuration:

  • Android Studio version: 4.0
  • Firebase Component: Firebase Performance Monitoring
  • Component version: 19.0.8
  • Kotlin: 1.4.0

This is working for me now using Android Gradle Plugin 4.1.0-rc02 alongside Firebase Perf Plugin and Kotlin 1.4.0. classpath 'com.android.tools.build:gradle:4.1.0-rc02'

Thank you all for providing us with detailed information!

We’ve determined that this is caused by the AGP version (public bug). A fix for this will be included in an upcoming AGP release; we’re currently confirming the exact details and will reply here when we have further information.

For now, we recommend building with AGP 3.5.4 (or before) as a workaround.

This problem has been fixed for me with the upgrade to Android Studio 4.1.

Also note that in the Example from SO the issue is happening when using JUnit5 libraries https://github.com/mannodermaus/android-junit5

For me the issue happens if the dependences are used without the “test” in front of implementation or runtimeOnly as shown below and only when running instrumentation tests.

  implementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
  runtimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"

i have this issue. How can i fix that…this drive me crazy.

I clean, rebuild …but in debug mode not work

My classpath is ‘com.android.tools.build:gradle:4.0.1’

Caused by: java.lang.IllegalStateException: Unexpected non-class file: META-INF\versions\9\javax\xml\bind\ModuleUtil.class

Caused by: org.gradle.tooling.BuildException: Failed to process: build\intermediates\transforms\FirebasePerformancePlugin\debug\0,

We’ve determined that this is caused by the AGP version (public bug).

Working link to bug: https://issuetracker.google.com/issues/165535092

edit:

For now, we recommend building with AGP 3.5.4 (or before) as a workaround.

Using classpath 'com.android.tools.build:gradle:3.5.4' to build Kotlin 1.4 with Firebase Performance is failing for me with the same error as before (Program type already present: kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsResourceLoader).

On the following fork from sunflower, I added the firebase performance sdk and the junit.jupiter as implementation and the error started to happen.

https://github.com/rddsantos/sunflower