Flutter错误:任务':app:compileDebugJavaWithJavac'的执行失败 [英] Flutter error: Execution failed for task ':app:compileDebugJavaWithJavac'
问题描述
我尝试在android上运行并返回此错误.
I try run on android and return this error.
我Aredy尝试过:
gradle.properties:
gradle.properties:
android.useAndroidX = trueandroid.enableJetifier = true
android.useAndroidX=true android.enableJetifier=true
build.gradle:
build.gradle:
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"multiDexEnabled是
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true
我的pubspec.yaml:
my pubspec.yaml:
flutter_facebook_login:^ 3.0.0firebase_database:^ 3.1.0firebase_auth:^ 0.15.0 + 1cloud_firestore:^ 0.12.11url_launcher:^ 5.2.7google_maps_flutter:^ 0.5.21 + 12image_picker:^ 0.6.2 + 1firebase_storage:^ 3.0.8国际:^ 0.16.0
flutter_facebook_login: ^3.0.0 firebase_database: ^3.1.0 firebase_auth: ^0.15.0+1 cloud_firestore: ^0.12.11 url_launcher: ^5.2.7 google_maps_flutter: ^0.5.21+12 image_picker: ^0.6.2+1 firebase_storage: ^3.0.8 intl: ^0.16.0
出了什么问题:任务':app:compileDebugJavaWithJavac'的执行失败.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
编译失败;有关详细信息,请参见编译器错误输出.
Compilation failed; see the compiler error output for details.
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.
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.
35秒钟内构建失败可能由于AndroidX导致构建失败插件不兼容.该工具即将尝试使用Jetfier解决不兼容问题.正在构建插件cloud_firestore ...由于上述问题,无法构建插件cloud_firestore.
BUILD FAILED in 35s The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility. Building plugin cloud_firestore... The plugin cloud_firestore could not be built due to the issue above.
解决方案:
SOLUTION:
创建新项目时,您是否选择了"androidX"?那些版本是最新版本吗?(表示androidX兼容/需要).如果不确定,请创建一个新项目,并确保选择androidX,并如上所述将sdk设置更改为23/29.
When you created the new project, did you select "androidX"? And are those versions the latest versions? (meaning, androidX compatible/requiring). if not sure, create a new project and make sure to select androidX, and change the sdk settings to 23/29 as above.
推荐答案
解决方案是结合使用选定的AndroidX创建新项目并将适当的SDK版本添加到gradle文件中的组合.可能使用正确的依赖版本.
Solution was a combination of creating a new project with AndroidX selected and add the proper SDK versions to the gradle file. Possibly with using correct dependency versions.
要迁移到AndroidX,您需要将SDK版本设置为21或更高版本.我建议使用23,因为这样也可以消除其他一些问题.
To migrate to AndroidX, you need to set the SDK versions to 21 or higher. I recommend 23 because that removes some other issues as well.
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example"
minSdkVersion 23
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
这篇关于Flutter错误:任务':app:compileDebugJavaWithJavac'的执行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!