android - 任务':android_intent:compileDebugJavaWithJavac'的Flutter执行失败
问题描述
我正在尝试构建该应用程序,但它一直因上述错误而失败。
我已经尝试过使用不同的 gradle 版本,即 5.6.4、6.3、6.5、6.8,但对我没有用,并且因同样的错误而失败。
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip。
我尝试将 minSdkVersion 更改为 21 和 23 但同样的错误。
我的jdk版本是15.0.1
安慰:
Parameter format not correct -
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
error: warnings found and -Werror specified
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android_intent:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 23s
Exception: Gradle task assembleDebug failed with exit code 1
build.gradle 文件
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '2'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.8.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.smartersvision.markets"
minSdkVersion 19
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
// signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-messaging:20.1.3'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.android.support:multidex:2.0.1' //enter the latest version
}
apply plugin: 'com.google.gms.google-services'
gradle-wrapper.properties。
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
pubspec.yaml 文件
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.6.0
environment:
sdk: ">=2.2.2 <3.0.0"
module:
androidX: true
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: 0.1.2
google_maps_flutter: 0.5.29
google_map_location_picker: 3.3.3
mvc_pattern: 6.1.3+2
global_configuration: 1.5.0
http: 0.12.2
html: 0.14.0+3
shared_preferences: 0.5.8
flutter_html: 1.0.2
flutter_svg: 0.18.0
location: 3.0.2
flutter_inappbrowser: 2.0.2
url_launcher: 5.5.0
firebase_messaging: 6.0.16
cached_network_image: 2.2.0+1
fluttertoast: ^7.1.1
flutter_staggered_grid_view: 0.3.2
intl_utils: 1.6.3
dev_dependencies:
flutter_test:
sdk: flutter
解决方案
如果它给您错误,请不要在颤振中使用意图,而是在本机 java 或 kotlin 中使用它,并使用方法通道在颤振中调用本机方法。
推荐阅读
- javascript - Vue修改DOM时如何调用函数?
- json - Flutter:setState 在第一次尝试时工作,但在响应 = 等待后没有工作
- pandas - 如何编写与 cutoff_time 一起使用的 seed_features
- vba - 在 MS Project 中使用 VBA 更改字段中的值
- python - 如何以“2019 年 8 月 21 日星期三 8:13 PM”格式打印日期时间?
- python - 更新 - 在找到标准后丢弃行时在熊猫中分组数据框
- angular - 异步管道不适用于相同的 observable
- javascript - PHP/AJAX:在下拉列表中选择数据后,HTML 表中的数据无法很好地显示
- php - 在创建自定义 WPForms 智能标签功能时在 functions.php 中使用自定义帖子类型标题
- jenkins - 如何在 Jenkins 构建计划中添加 ExtendedChoiceParameter?