我正在开发一个应用程序,它一直运行良好,直到我升级了gradle版本,现在这是错误。我也试图将版本更改为17,但它似乎不工作,并在设置android studio为17时更改了gradle的java版本。
Execution failed for task ':stripe_android:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin'
task (current target is 17) jvm target compatibility should be set to the same Java
version.
字符串
这是我的buld.gradle文件。在这里我根据错误进行了更改。
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.roam1.esim"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.sim"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.facebook.android:facebook-android-sdk:latest.release'
implementation platform('com.google.firebase:firebase-bom:32.4.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
}
型
2条答案
按热度按时间ecbunoof1#
这个错误是因为你试图使用Java 17而不是Java 8。
在您的
build.gradle
中字符串
检查:
Settings
->Build, Execution, Deployment
->Build Tools
->Gradle
检查
Gradle JDK
是否设置为1.8dhxwm5r42#
在您的bulid.gradle更新中,
字符串