Ionic 使用Android 10时出现离子构建错误minCompileSdk

vktxenjb  于 2022-12-09  发布在  Ionic
关注(0)|答案(1)|浏览(114)

我开始得到这个错误在离子构建...之前现在我的项目执行罚款,再次尝试我得到这个错误...请我需要帮助...我已经尝试了许多选项都无济于事
生成时出错

* What went wrong:
        Execution failed for task ':app:checkDebugAarMetadata'.
        > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
           > The minCompileSdk (31) specified in a
             dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
             is greater than this module's compileSdkVersion (android-30).
             Dependency: androidx.browser:browser:1.4.0.
             AAR metadata file: /private/var/root/.gradle/caches/transforms-3/fedb1dfce730f31190923d6e253eb6c6/transformed/browser-1.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.

我正在使用android@10。
我的build.gradle文件看起来像这样

buildscript {
    apply from: 'CordovaLib/cordova.gradle'
    apply from: 'repositories.gradle'
    repositories repos
    dependencies {
        classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${cordovaConfig.KOTLIN_VERSION}"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    def hasRepositoriesGradle = file('repositories.gradle').exists()
    if (hasRepositoriesGradle) {
        apply from: 'repositories.gradle'
    } else {
        apply from: "${project.rootDir}/repositories.gradle"
    }

    repositories repos
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
ut6juiuv

ut6juiuv1#

通过添加到android/app/build.gradle修复了我的问题

defaultConfig {
   // ... existing config
    configurations.all {
        resolutionStrategy { force 'androidx.browser:browser:1.3.0' }
    }
}

相关问题