Illegal class file: Class module-info is missing a super type. Class file version 53
Asked Answered
O

4

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'
}
Oddity answered 14/10, 2019 at 2:9 Comment(3)
Add your build.gradle to the question.Victory
try removing fabric and test it with performance only , maybe its a library conflict.?Stowell
Answered here: #58441909Puling
O
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

Obstetrics answered 21/10, 2019 at 8:1 Comment(7)
This solves my problem, thanks. I think, someone should report this to the bug tracker.Strage
Worked for me. I searched for 2 days for this solution.Echinus
Siddhivinayak After using the above code does the Perfomance API work?Capping
@Capping Nope it's disabling the Performance so that the build can proceed further. So this is a temporary solution to get your build working but you can try with an old version of the library or the plugin if available to make it work. Hopefully, that helps!Obstetrics
@Obstetrics clarification the api works on runtime?Capping
@Capping No, It doesn'tObstetrics
I can confirm that upgrading your gradle plugin to 3.6.0 is a permanent fix, should edit this answer to stop people from adding in this hack.Dorthea
O
6

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

Otter answered 24/2, 2020 at 1:15 Comment(2)
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 suggestingPunkah
@NickCardoso Android Gradle Plugin (AGP) and kenyee is suggesting that it's been fixed in the version 3.6Obstetrics
U
3

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

Ute answered 23/7, 2020 at 17:30 Comment(1)
3.6.0 is still in alpha wondering if anyone has a fix that does not involve using an alpha versionSledge
C
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)

Clostridium answered 2/3, 2021 at 9:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.