我的项目是一个简单的应用程序打印经度和纬度
我´使用:Linux Mint 19.3
类路径的com.android.tools.build: gradle: 4.1.3">
compileSdkVersion 31,编译的结果如下所示:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform play-services-base-17.0.0.aar (com.google.android.gms:play-services-base:17.0.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /home/luis/.gradle/caches/transforms-2/files-2.1/bb3cc3ced1388fcd9c0c925717b75148/jetified-play-services-base-17.0.0.
> AAPT2 aapt2-4.1.3-6503028-linux Daemon #6: Unexpected error during compile '/home/luis/.gradle/caches/transforms-2/files-2.1/bb3cc3ced1388fcd9c0c925717b75148/jetified-play-services-base-17.0.0/res/drawable-xxhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png', attempting to stop daemon.
minSDKVersion怎么样?试一试:compileSdkVersion 31minSdkVersion 21targetSdkVersion 29和地理定位器:^7.6.0
这与您的本地缓存有关。有两种方法可以解决这个问题。
- 尝试抖动pub缓存修复。 在android studio和syn Gradle中打开你的Project ProjectName/android项目。并通过android studio构建。
最后,我想在android/build.gradle
中解决这个问题。将4.1.0降级为3.4.2。为什么?因为我有另一个应用使用这个版本。
dependencies {
//classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}