20

When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53. My Gradle and google services project-level dependencies are

    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'

and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.

I have tried clean and rebuild and clearing the Android Studio cache.

And also tried similarly issue resolution from StackOverflow

Project level build gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.3.2'
        classpath 'com.google.firebase:perf-plugin:1.3.1'  // Performance Monitoring plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

App level build gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
        jcenter()

    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.31.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven {
        url 'https://maven.google.com'
    }

}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}
Eldhopj
  • 2,703
  • 3
  • 20
  • 39

4 Answers4

30

Adding this to your app-level build.gradle file solves the problem temporarily

debug {
          FirebasePerformance {
            // Set this flag to 'false' to disable @AddTrace annotation processing and
            // automatic HTTP/S network request monitoring
            // for a specific build variant at compile time.
            instrumentationEnabled false
          }
        }

EDIT as per other answers and comments

Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version

Siddhivinayak
  • 1,103
  • 1
  • 15
  • 26
6

FYI, this was an AGP bug...it's been fixed in AGP 3.6

kenyee
  • 2,309
  • 1
  • 24
  • 32
  • 1
    What is agp and do you have a source for whatever you're saying? I'm looking for a solution but I don't know what you're suggesting – Nick Cardoso Mar 12 '20 at 14:00
  • 1
    @NickCardoso Android Gradle Plugin (AGP) and kenyee is suggesting that it's been fixed in the version 3.6 – Siddhivinayak Apr 06 '20 at 09:28
3

On updating build Gradle from 3.5.1 to 3.6.0 fixed my issue.

bharath v
  • 51
  • 6
1

Also remove this from gradle.properties if you happen to have it there for any reason:

android.enableR8=false

(I got the error even with com.android.tools.build:gradle:4.1.2 if the above line was present)

oseiskar
  • 3,282
  • 2
  • 22
  • 22