gpt4 book ai didi

java - Android:错误:-source 1.3 中不支持注释

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:37:18 25 4
gpt4 key购买 nike

我试图添加一些模块,当我重建项目时我得到了这个错误:

error: annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)

我已经删除了模块,但错误仍然存​​在。尝试清理和重建,没有帮助。

我知道它与 java maven 有关,但我不明白如何解决它。也许这里有人可以提供帮助?

这是我的 Gradle :

buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.java.net/content/groups/public/"
}

maven { url 'https://jitpack.io' }

maven { url "https://maven.google.com" }


}
}

task clean(type: Delete) {
delete rootProject.buildDir
}






apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'


android {
compileSdkVersion 28
defaultConfig {
applicationId "com.eldareini.kotlin.meet4match"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

packagingOptions {
pickFirst 'META-INF/LICENSE.txt' // picks the JavaMail license file
}
compileOptions {
sourceCompatibility = kotlin_version
targetCompatibility = kotlin_version
}
buildToolsVersion = '28.0.3'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.sun.mail:android-mail:1.6.0'
implementation 'com.sun.mail:android-activation:1.6.0'
implementation 'com.github.mac229.FragmentUtils:fragmentutils-kt:1.0.1'
implementation 'com.github.mac229.FragmentUtils:fragmentutils:1.0.1'
implementation 'com.sun.mail:android-mail:1.6.0'
implementation 'com.sun.mail:android-activation:1.6.0'
implementation 'org.webrtc:google-webrtc:1.0.+'
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'
}

最佳答案

您正在使用库的 Kotlin 版本来指定构建的源/目标兼容性。

问题出在这里:

compileOptions {
sourceCompatibility = kotlin_version
targetCompatibility = kotlin_version
}

kotlin_version1.3

尝试以下操作:

compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}

关于java - Android:错误:-source 1.3 中不支持注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56621169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com