在构建Flutter移动应用时,我遇到了以下错误:
* What went wrong:
Execution failed for task ':location_permissions:parseReleaseLocalResources'.
> Could not resolve all files for configuration ':location_permissions:androidApis'.
> Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for PlatformAttrTransform: C:\Users\zukijuki\AppData\Local\Android\sdk\platforms\android-29\android.jar.
> C:\Users\zukijuki\AppData\Local\Android\sdk\platforms\android-29\android.jar
我android/build.gradle
配置如下:
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.28.1'
}
}
并且在下面的 app/build.gradle
文件中:
...
android {
compileSdkVersion 31
buildToolsVersion '28.0.3'
lintOptions {
//disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.example"
minSdkVersion 22
multiDexEnabled true
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resConfigs "en", "US"
}
...
}
flutter {
source '../..'
}
dependencies {
implementation("com.google.android.gms:play-services-base:17.0.0"){ force = true }
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
有没有解决上述问题的任何想法?
提前感谢您...
===更新
- gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
使用
Android Studio Bumblebee | 2021.1.1 Patch 3
构建重新安装API Level 29、30、31、32仍然无法解决问题。