I have a flutter app created with flutter version 2.2 and I'm trying to build it for android 13 (targetSdkVersion 33) and I get one of two build errors:
First (when gradle version is below 7):
Could not open proj generic class cache for build file 'path/to/app/android/app/build.gradle' (/Users/user/.gradle/caches/6.5/scripts/5d4nrc28gkbak7ua19lfgqqhx/proj9e897448d2c85f064c8b54ac35428928). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 62
Second (when gradle version is above 7):
In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.tasks.RenderscriptCompile' method 'useAndroidX()' should not be annotated with: @Input. Reason: Input/Output annotations are ignored if they are placed on something else than a getter.
the only thing I changed in my app to produce this error is in the build.gradle file in complileSdkVersion and targetSdkVersion and I changed it from 30 to 33:
android {
compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.name.app"
minSdkVersion 23
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
}
I've tried different versions of java and grade in all sorts of combinations and I keep getting one of those errors. It builds fine if the targetSdkVersion is 30. Could this be because of an old version of flutter?