Android应用Gradle插件版本适配问题求助
Android Gradle插件版本适配问题
我的Android应用使用如下build.gradle配置:
buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.0.2' } } repositories { google() mavenCentral() } apply plugin: 'com.android.application' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'com.google.android.gms:play-services-ads:21.3.0' implementation "com.android.billingclient:billing:4.0.0" }
编译时收到警告:
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33 This Android Gradle plugin (7.0.2) was tested up to compileSdk = 31 This warning can be suppressed by adding android.suppressUnsupportedCompileSdk=33 to this project's gradle.properties The build will continue, but you are strongly encouraged to update your project to use a newer Android Gradle Plugin that has been tested with compileSdk = 33
但尝试升级Gradle插件到7.4版本时,出现以下错误:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android-build'. > Could not resolve all artifacts for configuration ':classpath'. > Could not find com.android.tools.build:gradle:7.4. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom Required by: project : * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
改用7.2版本时,错误如下:
FAILURE: Build failed with an exception. * Where: Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17 * What went wrong: A problem occurred evaluating root project 'android-build'. > Failed to apply plugin 'com.android.internal.version-check'. > Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
这是怎么回事?
编辑1
指定插件版本为7.3.1时,出现相同的错误:
FAILURE: Build failed with an exception. * Where: Build file 'D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\build.gradle' line: 17 * What went wrong: A problem occurred evaluating root project 'android-build'. > Failed to apply plugin 'com.android.internal.version-check'. > Minimum supported Gradle version is 7.4. Current version is 7.2. If using the gradle wrapper, try editing the distributionUrl in D:\dev\repos\examples\src\LinesGame\build-LinesGameQt-Android_Qt_6_4_0_x86_64_debug_Clang_x86_64-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.4-all.zip * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
这可能是什么原因?
内容的提问来源于stack exchange,提问作者Alexey Starinsky
相关产品推荐
相关产品推荐

