我在构建Flatter移动应用程序时遇到以下错误:
* 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'
有没有办法解决上述问题?
提前谢谢你...
===update
- 格雷德尔.属性
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
-
使用
Android Studio Bumblebee | 2021.1.1 Patch 3
构建 -
重新安装API级别29,30,31,32仍然无法解决问题.