I'm not using Android Studio, I'm using a command line build with Android, Java, and Gradle, on a Windows machine.
I'm using the very latest Android SDK. Gradle version 5.6.4. Using a simple skeletal Android Gradle app. With these files:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '30.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
And, no matter what Gradle version I use, or what buildToolsVersion, I get the same error.
I'm also not using gradlew, but I've tried it and it still didn't work.
This is what I use to do the build: SET ANDROID_HOME=C:/android-sdk-win&&SET PATH=C:/gradle-5.6.4/bin;%PATH%&&SET JAVA_HOME=C:/Program Files (x86)/Java/jdk1.8.0_20&&cd C:/Android/Dev/G_BaseBuild&&gradle clean
When I try to do the initial 'gradle clean' I get this:
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring project ':app'.
Failed to notify project evaluation listener. Uninitialized object exists on backward branch 142 Exception Details: Location: c om/android/build/gradle/internal/pipeline/ VariantInfoImpl.(Lcom/android/build/gradle/internal/scope/ VariantScope;)V @200: goto Reason: Error exists in the bytecode Bytecode: 0x0000000: 2b12 3cb8 0034 2a2b b900 4201 0059 1244 0x0000010: b800 47b6 004d b900 5201 002b b900 5401 0x0000020: 0059 1256 b800 472b b900 4201 0059 1244 0x0000030: b800 47b6 005a c000 5c59 125e b800 47b9 0x0000040: 0061 0100 5912 63b8 0047 2bb9 0042 0100 0x0000050: 5912 44b8 0047 b600 6759 1269 b800 47c0 0x0000060: 006b 4d3a 0e3a 0d36 0c3a 0b03 3e2c 3a04 0x0000070: bb00 6d59 2c10 0ab8 0073 b700 76c0 0078 0x0000080: 3a05 0336 0619 04b9 007c 0100 3a07 1907 0x0000090: b900 8101 0099 0036 1907 b900 8501 003a 0x00000a0: 0819 0519 08c0 0087 3a09 3a0f 0336 0a19 0x00000b0: 0959 1289 b800 47b9 008a 0100 3a10 190f 0x00000c0: 1910 b900 8e02 0057 a7ff c619 05c0 0090 0x00000d0: 3a0f 190b 150c 190d 190e 190f c000 6bb8 0x00000e0: 0096 2bb9 0042 0100 5912 44b8 0047 b600 0x00000f0: 5ac0 005c 5912 5eb8 0047 b900 9801 00b7 0x0000100: 009a b1
Stackmap Table: f ull_frame(@142,{UninitializedThis,Object[#62],Object[ #107],Integer,Object[#107],Object[#120],Integer, Object[#126],Top,Top,Top,UninitializedThis,Integer,Object[ #169],Object[#169]},{}) same_frame(@203)
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
I can't get: classpath 'com.android.tools.build:gradle:3.4.1'
to work, much less anything newer.
But if I use: classpath 'com.android.tools.build:gradle:3.3.3'
It builds fine.
What should I try to get this to be able to do a successful 'gradle clean' with possibly a newer Android Gradle Plugin?
Thanks!!
****** UPDATE ******
I was looking at everything Android Studio was using when it would do a Clean, and Build, and I saw that it was using it's own JRE/JDK at C:\Program Files\Android\Android Studio\jre So I updated everything to try to duplicate what it was using and it worked!!
But, what I found out is that Android Studio seems to be using a version of the OpenJdk.
Using Android Studio, I had it switch to using the same JDK I was using and it started getting the same bytecode errors.
So I downloaded and installed an OpenJdk, pointed to it in my build and then I could do a 'gradle clean' and 'gradle assembleDebug' without any issues!
Thanks!