当我尝试在android模拟器上运行flutter应用程序时遇到此错误,我使用MacBook和VSCode,该应用程序在ios模拟器上运行良好。
*** What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' is set to compileOnly/provided which is not supported**
**These are my build.gradle dependcies:**
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
和gradle.properties内部,这就是我所拥有的:
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
我的应用程序级别build.gradle中的:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.androidx.support.test:runner:1.1.0'
androidTestImplementation 'com.androidx.support.test.espresso:espresso-core:3.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
最佳答案
我认为这是版本冲突。只需更改gradle和kotlin版本即可解决此问题。
// change kotlin_version above 1.3.0 like 1.3.31
// change build gradle version from 3.2.1 to 3.3.2
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31"
我认为这可能对您有帮助。
关于android - Flutter应用程式中的Gradle失败AndroidX不相容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59349449/