【发布时间】:2022-01-20 09:56:16
【问题描述】:
第 1 部分:-
拿到这个版本的Android Studio后,我就可以在我的项目中使用JDK17了。 一切正常,没有构建失败,没有运行时错误等。 (就像增强型开关工作正常) ....但是这个警告在每次构建期间都会不断出现。有没有办法抑制这个?
(警告文本 -> “一个或多个类的文件版本 >= 56,不受官方支持”)
这些是 build.gradle 文件:
(1):-
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-rc01'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
(2):-
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
defaultConfig {
applicationId "com.Sujal_Industries.SelfEmot"
minSdkVersion 21
targetSdkVersion 32
versionCode 11
versionName "1.3.1"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha01'
implementation 'androidx.core:core-splashscreen:1.0.0-beta01'
implementation 'com.google.mlkit:image-labeling:17.0.6'
implementation 'com.google.android.material:material:1.6.0-alpha01'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.3'
}
(我尝试搜索类似的警告但没有运气)
第 2 部分:-
最近,我发现 Android Studio 现在显示了创建新 Java Record 的选项。
那么.. 有没有办法在 java.lang 包中强制添加 Record 类?
(如果需要更多信息/澄清,请告诉我)
编辑:我知道 11 以上的版本不官方支持,但没有解决方法吗?
【问题讨论】:
标签: java android android-studio java-17 java-record