-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix NDK path detection #103
Conversation
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
sdkmanager --uninstall "extras;android;m2repository" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only a problem in very old Android Gradle Plugin versions. This even predates the support library vs. AndroidX migration thing. I don't think it's needed anymore, and it would be almost impossible to set up a working project that tests this successfully (this needs an old AGP version, which needs an old Gradle version, which needs JDK8, etc.)
if androidHome := envRepo.Get("ANDROID_HOME"); androidHome != "" { | ||
// The most modern way is to install NDK versions side-by-side at $ANDROID_HOME/ndk/version | ||
// This is what `sdkmanager` does when installing a specific version (`sdkmanager "ndk;26.3.11579264"`). | ||
ndkPath := filepath.Join(androidHome, "ndk", requestedNDKVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only work if specifying the exact version number right? Dunno if it is a problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole thing only works with exact numbers because that's what is recorded in source.properties
and that's what sdkmanager --install
expects unfortunately.
Checklist
step.yml
andREADME.md
is updated with the changes (if needed)Version
Requires a PATCH version update
Context
NDK installation and configuration has changed a lot over the years: https://github.com/android/ndk-samples/wiki/Configure-NDK-Path#the-default-ndk-location
It's also installed incorrectly on the Ubuntu 20 stack, which we fixed on Ubuntu 22. This in turn broke this step, which assumed the incorrect install location of the Ubuntu 20 stack (see #102)
Changes
Clean up and rework the NDK location detection logic. I tried to comment the code as much as possible to preserve the reasoning.
Investigation details
Decisions