Mattia
Mattia

Reputation: 426

Flutter application crash on android run - java.lang.VerifyError: Verifier rejected class androidx.profileinstaller.ProfileVerifier

I need an help about a very strange error, never show during my long experience.

I have a Flutter application that run on iOs but not in Android; when I launch application on my physical tablet, it starts and I can show the app for a few seconds (after the splash screen). After 3 seconds, in the Logcat I see the following error:

FATAL EXCEPTION: pool-33-thread-1 Process: <my_package>, PID: 27435 java.lang.VerifyError: Verifier rejected class androidx.profileinstaller.ProfileVerifier: com.google.common.util.concurrent.ListenableFuture androidx.profileinstaller.ProfileVerifier.getCompilationStatusAsync() failed to verify: com.google.common.util.concurrent.ListenableFuture androidx.profileinstaller.ProfileVerifier.getCompilationStatusAsync(): [0x2] can't resolve returned type 'Unresolved Reference: com.google.common.util.concurrent.ListenableFuture' or 'Unresolved Reference: androidx.concurrent.futures.ResolvableFuture' (declaration of 'androidx.profileinstaller.ProfileVerifier' appears in /data/app/~~cnQRl-OAEZI6oLdDlA013w==/<my_package>-Cihr4RMpxNwnpaULXgPVAw==/base.apk) at androidx.profileinstaller.ProfileVerifier.writeProfileVerification(ProfileVerifier.java:129) at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:577) at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:515) at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:479) at androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2(ProfileInstallerInitializer.java:145) at androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda1.run(Unknown Source:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923)

Flutter version is 3.7.10 Dart version is 2.19.6 DevTools version is 2.20.1

I can't find any solution.

I tried to update Flutter version, work on build.gradle files, but nothing change.

Here my android/build.gradle:

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

Here my android/app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 33

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        applicationId <my_package>
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        ndkVersion "25.1.8937393"
        multiDexEnabled true
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
}

apply plugin: 'com.google.gms.google-services'

Upvotes: 0

Views: 609

Answers (1)

Mattia
Mattia

Reputation: 426

I figured out the error: multidex Here I found this Google message:

Caution: Don't execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.

I removed multidex from app/build.gradle and it works.

Very strange, because the application worked until 2 months ago.

Upvotes: 1

Related Questions