Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Thank you for your feedback. Team may reach out for more feedback in reproducing or triaging this issue.
rp...@google.com <rp...@google.com> #3
Could it be a Gradle plugin issue?
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #4
In 3.2.0-alpha02 we started compiling against android.jar and core-lambda-stubs.jar (coming from build tools). Previously, we were compiling against JDK and android.jar which could lead to some issues.
It might be that android.jar is corrupted or android.jar is missing altogether. Is the command from #1 what you use to download the SDK on the CI? Also, can you please check if $ANDROID_HOME/platforms/android-27/android.jar on the CI contains java/lang classes?
It might be that android.jar is corrupted or android.jar is missing altogether. Is the command from #1 what you use to download the SDK on the CI? Also, can you please check if $ANDROID_HOME/platforms/android-27/android.jar on the CI contains java/lang classes?
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #5
Yes, the command in #1 is what I used to download the SDK on the CI.
$ANDROID_HOME/platforms/android-27/android.jar is 29514833 bytes with a SHA256SUM of ab3f5a358b25b203e4678a5dc7b0e442f4fd1ccfeb6e29914d46d4c8ead22c9a and it contains a java/lang directory with about 160 files/directories inside of it.
$ANDROID_HOME/platforms/android-27/android.jar is 29514833 bytes with a SHA256SUM of ab3f5a358b25b203e4678a5dc7b0e442f4fd1ccfeb6e29914d46d4c8ead22c9a and it contains a java/lang directory with about 160 files/directories inside of it.
ga...@google.com <ga...@google.com> #6
Does the build pass on the CI, if you specify add android.enableCoreLambdaStubs=false to gradle.properties file?
ga...@google.com <ga...@google.com> #7
Also, which JDK version are you using on the CI? What is the output of `java -version`?
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #8
I get the same error with the enableCoreLambdaStubs flag set to false: ":app:compileJunitReleaseJavaWithJavacFatal Error: Unable to find package java.lang in classpath or bootclasspath"
`java -version` gives:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
`java -version` gives:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
ga...@google.com <ga...@google.com> #9
Android SDK SHA and java in the $PATH look good. Are you setting JAVA_HOME to JDK9 in the CI script? Can you please share your build files and CI script?
ga...@google.com <ga...@google.com> #10
To check which version of JVM is used when building with Gradle, you can add the following to build.gradle:
println "Java version is ${JavaVersion.current()}"
println "Java version is ${JavaVersion.current()}"
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #11
The files you've asked for are attached. The println returned:
Java version is 1.8
The CI script is super-simple:
./gradlew lintJunitRelease assembleJunitRelease assembleDebug assembleJunitDebugAndroidTest assembleBddDebugAndroidTest
Java version is 1.8
The CI script is super-simple:
./gradlew lintJunitRelease assembleJunitRelease assembleDebug assembleJunitDebugAndroidTest assembleBddDebugAndroidTest
ga...@google.com <ga...@google.com> #12
Thanks for sharing. Can you please remove android.enableCoreLambdaStubs=false from gradle.properties, and add to app/build.gradle:
project.afterEvaluate {
def t = getTasks().findByPath(":app:compileJunitReleaseJavaWithJavac")
println "For task $t"
println "Bootclasspath is ${t.options.bootstrapClasspath.getFiles()}"
}
Also, can you please upload output of CI build with --debug?
project.afterEvaluate {
def t = getTasks().findByPath(":app:compileJunitReleaseJavaWithJavac")
println "For task $t"
println "Bootclasspath is ${t.options.bootstrapClasspath.getFiles()}"
}
Also, can you please upload output of CI build with --debug?
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #13
Sure thing, the output from the build is attached.
ga...@google.com <ga...@google.com> #14
The output looks perfectly reasonable with:
"Compiler arguments: -source 1.7 -target 1.7 -d /home/jenkins/workspace/TEA_1_Commit_Build/app/build/intermediates/artifact_transform/javac/junit/release/classes -encoding UTF-8 -bootclasspath /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar:/home/jenkins/tools/android-sdk/build-tools/27.0.3/core-lambda-stubs.jar"
That is expected bootclasspath. You've already confirmed that it is JDK 8 on the CI. For completeness, can you please share SHA256 for /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar, and for /home/jenkins/tools/android-sdk/build-tools/27.0.3/core-lambda-stubs.jar.
Also, can you please try to disable Gradle caching by adding org.gradle.caching=true to gradle.properties? I am pretty sure that is not the issue here, but just to be completely confident.
"Compiler arguments: -source 1.7 -target 1.7 -d /home/jenkins/workspace/TEA_1_Commit_Build/app/build/intermediates/artifact_transform/javac/junit/release/classes -encoding UTF-8 -bootclasspath /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar:/home/jenkins/tools/android-sdk/build-tools/27.0.3/core-lambda-stubs.jar"
That is expected bootclasspath. You've already confirmed that it is JDK 8 on the CI. For completeness, can you please share SHA256 for /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar, and for /home/jenkins/tools/android-sdk/build-tools/27.0.3/core-lambda-stubs.jar.
Also, can you please try to disable Gradle caching by adding org.gradle.caching=true to gradle.properties? I am pretty sure that is not the issue here, but just to be completely confident.
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #15
I tried with "org.gradle.caching=true" and still got the same issue, but wouldn't setting that to true enable caching?
The sha256sums are:
jfiggins@localhost:/home/jenkins/tools/android-sdk/platforms/android-27> sha256sum android.jar
aac4e12f1fd2dede4b8970de3c6a54eddc3e0fa098bf749dc5d6efe5d6e9c4d7 android.jar
jfiggins@localhost:/home/jenkins/tools/android-sdk/build-tools/27.0.3> sha256sum core-lambda-stubs.jar
00b116aa25e9d2bd4561c3c21d0e7293c2523ffceb25b2f1ae6a700c1e364478 core-lambda-stubs.jar
Note: the sha256 for android.jar is different than what I reported in #5 because I'm experiencing the same issue on two build machines and since #8, I've been trying the steps you've suggested on the backup build machine (so as not to disturb the production environment). The hash in #5 is from the production machine. Both were installed using the same command line as in #1, but the backup machine had a slightly older installation. I went ahead and did a "sdkmanager --update" and on the backup machine, and I'm still seeing the same issue and the hashes are unchanged.
The sha256sums are:
jfiggins@localhost:/home/jenkins/tools/android-sdk/platforms/android-27> sha256sum android.jar
aac4e12f1fd2dede4b8970de3c6a54eddc3e0fa098bf749dc5d6efe5d6e9c4d7 android.jar
jfiggins@localhost:/home/jenkins/tools/android-sdk/build-tools/27.0.3> sha256sum core-lambda-stubs.jar
00b116aa25e9d2bd4561c3c21d0e7293c2523ffceb25b2f1ae6a700c1e364478 core-lambda-stubs.jar
Note: the sha256 for android.jar is different than what I reported in #5 because I'm experiencing the same issue on two build machines and since #8, I've been trying the steps you've suggested on the backup build machine (so as not to disturb the production environment). The hash in #5 is from the production machine. Both were installed using the same command line as in #1, but the backup machine had a slightly older installation. I went ahead and did a "sdkmanager --update" and on the backup machine, and I'm still seeing the same issue and the hashes are unchanged.
ga...@google.com <ga...@google.com> #16
The paths seem differ in #14 and in #15:
in #14: /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar,
in #15: /home/jenkins/tools/android-sdk/platforms/android-27/android.jar
Can you please send sha256sum for paths in #14 for android.jar and core-lambda-stubs.jar?
in #14: /home/jenkins/workspace/tools/android-sdk/platforms/android-27/android.jar,
in #15: /home/jenkins/tools/android-sdk/platforms/android-27/android.jar
Can you please send sha256sum for paths in #14 for android.jar and core-lambda-stubs.jar?
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #17
Well, that allowed me to zero in on the issue.
There is no /home/jenkins/workspace/tools in my environment. But $ANDROID_HOME is set to a relative path on my CI systems. If I change it to an absolute path, the builds work as expected. And on the 3.1.0-alpha04 plugin, the relative paths work.
So, the issue is that relative paths for $ANDROID_HOME no longer work in newer version of the Android gradle plugin.
I've attached the latest build outputs for the 3.1.0-alpha04 and the 3.2.0-alpha04 plugins when using relative paths. With the older plugin, the paths are resolved differently:
07:53:06.626 [QUIET] [system.out] Bootclasspath is [/home/jenkins/workspace/TEA_1_Commit_Build/../../tools/android-sdk/platforms/android-27/android.jar]
There is no /home/jenkins/workspace/tools in my environment. But $ANDROID_HOME is set to a relative path on my CI systems. If I change it to an absolute path, the builds work as expected. And on the 3.1.0-alpha04 plugin, the relative paths work.
So, the issue is that relative paths for $ANDROID_HOME no longer work in newer version of the Android gradle plugin.
I've attached the latest build outputs for the 3.1.0-alpha04 and the 3.2.0-alpha04 plugins when using relative paths. With the older plugin, the paths are resolved differently:
07:53:06.626 [QUIET] [system.out] Bootclasspath is [/home/jenkins/workspace/TEA_1_Commit_Build/../../tools/android-sdk/platforms/android-27/android.jar]
ga...@google.com <ga...@google.com> #18
Relative path evaluation has changed for javac after 3.1.0-alpha06.
We used to set bootclasspath as string, so that would get passed to javac as a simple concatenation of root project path and relative path e.g. $ROOT/../../Android/Sdk/platforms/android-27/android.jar. From 3.1.0-alpha06, we are using org.gradle.api.Project.files() to compute the FileCollection that is set as bootclasspath. Because path is relative, its base will be the project root, which is in your case $ROOT/app. That is why the resulting path with 3.2.0-alpha02 is wrong.
I am working on a fix, but in the meantime, please set ANDROID_HOME using absolute path.
We used to set bootclasspath as string, so that would get passed to javac as a simple concatenation of root project path and relative path e.g. $ROOT/../../Android/Sdk/platforms/android-27/android.jar. From 3.1.0-alpha06, we are using org.gradle.api.Project.files() to compute the FileCollection that is set as bootclasspath. Because path is relative, its base will be the project root, which is in your case $ROOT/app. That is why the resulting path with 3.2.0-alpha02 is wrong.
I am working on a fix, but in the meantime, please set ANDROID_HOME using absolute path.
ga...@google.com <ga...@google.com> #19
This issue will be fixed in 3.2.0-alpha06. As a temporary workaround please use advice from #18, or you can set sdk.dir in local.properties using relative path.
Thank you for your help while debugging this issue!
ag/I59f3125cea8f72a8e0452209510fe0228dbf63de
Thank you for your help while debugging this issue!
ag/I59f3125cea8f72a8e0452209510fe0228dbf63de
jf...@3rdeyecam.com <jf...@3rdeyecam.com> #20
And thank you for fixing it promptly! I look forward to trying out the alpha06 plugin. Thanks!
Description
Android Plugin Version: 3.2.0-alpha02
Module Compile Sdk Version: 27
Module Build Tools Version: 27.0.3
Android SDK Tools version: 26.1..1
The CI installation of the Android SDK works with the 3.1.0-alpha04 plugin, but does not with the 3.2.0-alpha02. I haven't tested the intermediate plugin versions to see where it breaks.
I downloaded the standalone tools and then ran the following:
./sdkmanager "add-ons;addon-google_apis-google-21" "add-ons;addon-google_apis-google-22" "add-ons;addon-google_apis-google-23" "add-ons;addon-google_apis-google-24" "build-tools;27.0.3" "extras;android;m2repository" "extras;google;google_play_services" "extras;google;m2repository" "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" "platforms;android-21" "platforms;android-22" "platforms;android-23" "platforms;android-24" "platforms;android-25" "platforms;android-26" "system-images;android-21;google_apis;x86" "system-images;android-22;google_apis;x86" "system-images;android-23;google_apis;x86" "system-images;android-24;google_apis;x86" "system-images;android-25;google_apis;x86" "system-images;android-26;google_apis;x86" "platforms;android-27" "system-images;android-27;google_apis;x86"
Using an SDK that was installed using Android Studio works just fine.
The error is:
:app:compileReleaseJavaWithJavacFatal Error: Unable to find package java.lang in classpath or bootclasspath
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.