You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter安卓端启动崩溃:java.lang.VerifyError(ProfileVerifier类验证失败)

解决方案

1. 强制指定ProfileInstaller稳定版本

在android/app/build.gradle的dependencies块中添加强制依赖,解决ProfileInstaller版本不兼容导致的类解析问题:

implementation('androidx.profileinstaller:profileinstaller:1.3.1') {
    force = true
}

2. 替换冲突的ListenableFuture依赖

移除原有的Guava空占位依赖,改用AndroidX官方的并发Future实现,匹配ProfileInstaller的依赖需求:

// 移除这一行
// implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

// 添加AndroidX版本
implementation 'androidx.concurrent:concurrent-futures:1.1.0'

3. 对齐Gradle与Kotlin插件版本

你的Kotlin版本(1.9.0)与Gradle插件版本(7.0.0)不匹配,修改android/build.gradle中的配置:

buildscript {
    ext.kotlin_version = '1.8.22' // 与Gradle 7.4.x版本兼容
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2' // 升级到兼容版本
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // 其他依赖保持不变
    }
}

同时修改android/gradle/wrapper/gradle-wrapper.properties中的Gradle分发版本:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

4. 清理缓存并重新构建

执行以下命令彻底清理缓存并重新编译项目:

flutter clean
flutter pub get
cd android && ./gradlew clean build --refresh-dependencies
cd .. && flutter run

内容的提问来源于stack exchange,提问作者Mattia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 15:17:49