Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AGP to version 8.2.1 or newer #2680

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rvandermeulen
Copy link
Contributor

No description provided.

@rvandermeulen rvandermeulen changed the title Update Gradle to v8.5 and AGP to v8.1.4 Update Gradle to v8.5 and AGP to v8.2.0 Dec 3, 2023
@badboy
Copy link
Member

badboy commented Dec 4, 2023

mozilla.telemetry.glean.GleanFromJavaTest > testGleanExperimentsAPIWithOptional FAILED
    java.lang.NoClassDefFoundError at GleanFromJavaTest.java:64
        Caused by: java.lang.ExceptionInInitializerError at NativeLibrary.java:323

interestingly this doesn't fail for me locally

@badboy
Copy link
Member

badboy commented Dec 4, 2023

java.lang.UnsatisfiedLinkError: Unable to load library 'xul':
libxul.so: cannot open shared object file: No such file or directory
libxul.so: cannot open shared object file: No such file or directory

oh, that last log line was not even accurate.
It cannot find the library to begin with!

@badboy
Copy link
Member

badboy commented Dec 4, 2023

Hm, is this this?

@rvandermeulen
Copy link
Contributor Author

AGP 8.1+ seem to be buggy in general when it comes to overly-aggressive optimizations by R8. mcarare has had a number of issues with that with Fenix too. Talking to him, we both kind of figured this was a similar issue but I haven't really had time to poke around with disabling the different R8 optimizations to see if any of them happen to fix this. Been just kind keeping my fingers crossed that maybe a newer AGP would eventually sort it out 😄

@rvandermeulen
Copy link
Contributor Author

@badboy Feel free to take over this PR if you're feeling so inclined. This hasn't been a high priority for me.

@badboy
Copy link
Member

badboy commented Dec 4, 2023

@badboy Feel free to take over this PR if you're feeling so inclined. This hasn't been a high priority for me.

Nah, I just wanted to look if there's anything low-hanging that can make this work. But I equally don't really have the time right now to see that through, so if that's not currently high priority and required for anything this will be defered a bit longer.

@rvandermeulen rvandermeulen changed the title Update Gradle to v8.5 and AGP to v8.2.0 Update Gradle to v8.5 and AGP to v8.2.1 Jan 5, 2024
@jonalmeida
Copy link

@badboy this is just a fly-by comment: consider disabling R8 fullmode for now, as we have done in fenix/focus, so that it doesn't block you from upgrading to a newer version of AGP.

@badboy
Copy link
Member

badboy commented Jan 15, 2024

well, that didn't fix things on its own.

@rvandermeulen rvandermeulen changed the title Update Gradle to v8.5 and AGP to v8.2.1 Update Gradle to version 8.5 Jan 19, 2024
@rvandermeulen rvandermeulen changed the title Update Gradle to version 8.5 Update AGP to version 8.2.1 or newer Jan 19, 2024
@rvandermeulen
Copy link
Contributor Author

I'm going to punt on updating AGP for now and focus just on updating Gradle in a new PR.

@badboy
Copy link
Member

badboy commented Apr 15, 2024

I tried looking into this once more.
I'm still not sure how to fix it.

On main running ./gradlew --no-daemon :glean:testDebugUnitTest --tests GleanTest will put a libxul.so into these paths:

glean-core/android/build/intermediates/java_res/debugUnitTest/out/linux-x86-64/libxul.so
glean-core/android-native/build/rustJniLibs/desktop/linux-x86-64/libxul.so

The first one is from where the tests will load libxul.so.

On this branch it only ends up in

glean-core/android-native/build/rustJniLibs/desktop/linux-x86-64/libxul.so

and according to the tests the resource path includes glean-core/android/build/intermediates/java_res/debugUnitTest/processDebugUnitTestJavaRes/out/ instead.
That has processDebugUnitTestJavaRes added.

On my Macbook on this branch libxul.dylib ends up in

glean-core/android/build/intermediates/java_res/debugUnitTest/processDebugUnitTestJavaRes/out/darwin-aarch64/libxul.dylib

and thus the tests work.


So for some reason on Linux the libxul.so is not copied where it should be, but I don't know why.

@jonalmeida
Copy link

@badboy shot in the dark: maybe compare the results on linux with your mac using the command below that will re-run all the tasks (disables task caching) and dry-run to see the tasks in an easily diff-able way. Maybe there is something different happening on each?

./gradlew --no-daemon --rerun-tasks --dry-run :glean:testDebugUnitTest --tests GleanTest

@badboy
Copy link
Member

badboy commented Apr 16, 2024

The only difference is which cargo build task is invoked, which is expected.

--- gradle-linux.log	2024-04-16 18:42:48
+++ gradle-macos.log	2024-04-16 18:41:51
@@ -82,11 +82,11 @@
 :glean:generateDebugUnitTestConfig SKIPPED
 :glean:processDebugJavaRes SKIPPED
 :generateLinkerWrapper SKIPPED
-:glean-native:cargoBuildLinux-x86-64 SKIPPED
+:glean-native:cargoBuildDarwin-aarch64 SKIPPED
 :glean-native:cargoBuild SKIPPED
 :glean:processDebugUnitTestJavaRes SKIPPED
 :glean-native:bundleLibRuntimeToJarDebug SKIPPED
 :glean-native:processDebugJavaRes SKIPPED
 :glean:testDebugUnitTest SKIPPED
 
-BUILD SUCCESSFUL in 6s
+BUILD SUCCESSFUL in 4s

@rvandermeulen
Copy link
Contributor Author

rvandermeulen commented May 7, 2024

I can't shake this feeling that jnaForTest is the source of the problem, specifically the jnaForTestConfiguration stuff in android-native/publish.gradle.

@rvandermeulen
Copy link
Contributor Author

rvandermeulen commented Jul 19, 2024

FYI, this blocks updating to and compiling with the Android SDK 35 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants