Closed hOlMoo closed 6 months ago
The information you provided is not enough, but I guess it is a JDK version issue
Upgrade the JDK to 11/17.
Same issue when compile with JavaVersion.VERSION_1_8
Transform debug (project :photo_manager) with DexingNoClasspathTransform ERROR:****/photo_manager/BuildConfig.class: D8: com.android.tools.r8.internal.YI0: Unsupported class file version: 62
Same issue when compile with JavaVersion.VERSION_1_8
Transform debug (project :photo_manager) with DexingNoClasspathTransform ERROR:****/photo_manager/BuildConfig.class: D8: com.android.tools.r8.internal.YI0: Unsupported class file version: 62
May caused by the getJavaVersion method in build.gradle.
compileOptions { sourceCompatibility javaVersion targetCompatibility javaVersion }
The build will succeed, if I replace with the following script: compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
@huoshen2023 Couple questions, I'm having the same problem literally on the same day.
1) What's your java version
2) What's your distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3) Should I be using javaVersion
or JavaVersion.VERSION_1_8
@huoshen2023 Couple questions, I'm having the same problem literally on the same day.
- What's your java version
- What's your
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
- Should I be using
javaVersion
orJavaVersion.VERSION_1_8
I use JavaVersion.VERSION_1_8 in my app project
gradle plugin doesnt matter, I use gradle-7.4-all.zip
User JavaVersion.VERSION_1_8, you have to modify the build.gradle of photo_manager
@hOlMoo Here are my grade files, could you point out what could be wrong with them?
java -version
java version "18.0.1" 2022-04-19
Java(TM) SE Runtime Environment (build 18.0.1+10-24)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1+10-24, mixed mode, sharing)
build.gradle
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
app/build.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'
}
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = 19
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = 30
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.curbian.chorus"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutterMinSdkVersion.toInteger()
targetSdkVersion flutterTargetSdkVersion.toInteger()
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
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.release
}
}
}
flutter {
source '../..'
}
dependencies {
// Allow for uploading to PlayStore
implementation 'com.google.android.material:material:1.12.0-rc01'
}
settings.gradle
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.2.2" apply false
id "org.jetbrains.kotlin.android" version "1.7.22" apply false
id "com.google.gms.google-services" version "4.4.1" apply false
id "com.google.firebase.crashlytics" version "2.9.9" apply false
}
include ":app"
@hOlMoo Here are my grade files, could you point out what could be wrong with them?
java -version
java version "18.0.1" 2022-04-19 Java(TM) SE Runtime Environment (build 18.0.1+10-24) Java HotSpot(TM) 64-Bit Server VM (build 18.0.1+10-24, mixed mode, sharing)
build.gradle
allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir }
app/build.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' } def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion') if (flutterMinSdkVersion == null) { flutterMinSdkVersion = 19 } def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion') if (flutterTargetSdkVersion == null) { flutterTargetSdkVersion = 30 } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { applicationId "com.curbian.chorus" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion flutterMinSdkVersion.toInteger() targetSdkVersion flutterTargetSdkVersion.toInteger() versionCode flutterVersionCode.toInteger() versionName flutterVersionName } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 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.release } } } flutter { source '../..' } dependencies { // Allow for uploading to PlayStore implementation 'com.google.android.material:material:1.12.0-rc01' }
settings.gradle
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath }() includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.2.2" apply false id "org.jetbrains.kotlin.android" version "1.7.22" apply false id "com.google.gms.google-services" version "4.4.1" apply false id "com.google.firebase.crashlytics" version "2.9.9" apply false } include ":app"
As mentioned before, you have to modify the build.gradle of photo_manager
Platforms
dart
Description
Why
how to fix