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

merge wiki into developer.android.com if necessary and delete #1087

Open
gmackall opened this issue Oct 22, 2024 · 4 comments
Open

merge wiki into developer.android.com if necessary and delete #1087

gmackall opened this issue Oct 22, 2024 · 4 comments

Comments

@gmackall
Copy link

gmackall commented Oct 22, 2024

Hi, I'm hoping for some clarification on when AGP will install the NDK, i.e. asking if
https://github.com/android/ndk-samples/wiki/Configure-NDK-Path#ndk-with-agp-41
is also relevant to newer AGP versions.

Per https://github.com/android/ndk-samples/wiki/Configure-NDK-Path#ndk-with-agp-41,
AGP 4.1 (but maybe not newer?) will automatically install the NDK if it isn't installed already.

Per https://developer.android.com/studio/projects/install-ndk#install_ndk_and_cmake_automatically
AGP 4.2+ will automatically install the specified NDK version the first time the project is built, and only if the licenses are pre-accepted.

Per https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41,
Maybe this is only done by Android Studio? For AGP 4.2+.

The reason I ask is because I'm trying to decide on a path for Flutter to get debug symbols included in app bundles by default (one of our most liked issues flutter/flutter#60240). Ideally, I'd like avoid re-inventing the wheel and instead rely on AGP to do this, as AGP has the ability to strip prebuilt libraries and package the debug symbols appropriately within the app bundle.

But per @DanAlbert's comment on android/ndk#1844, this behavior only works if the ndk is installed, so I'd like to be sure that users will have the NDK installed (otherwise from my local testing, the debug symbols end up getting included in the actual app, which would be a very bad outcome).

Per my local testing, if I remove all locally installed ndk versions and then make a new (Flutter) project using AGP 8.1, the ndk doesn't seem to be get installed, and instead we see logs:

 C/C++: Folder /Users/mackall/Library/Android/sdk/ndk/26.1.10909125 does not exist. Ignoring.
[        ] C/C++: Folder /Users/mackall/Library/Android/sdk/ndk-bundle does not exist. Ignoring.
[        ] Unable to strip library '/Users/mackall/development/BugTesting/fifth/build/app/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/x86_64/libflutter.so' due to missing strip tool for ABI
'x86_64'. Packaging it as is.

Is this expected behavior, or is Flutter somehow missing some configuration that would be required to get the ndk installed automatically?

Also sorry if this is the wrong place to ask the question - it relates to the first sample page, but I'm aware the question is also slightly more broad than that so feel free to redirect me if this isn't the right place to ask.

@DanAlbert
Copy link
Member

Ugh, why do we even have those docs. That's just asking for things to be out of sync with the real docs. I'll delete (well, replace with a page that does nothing but link to the real docs) those pages once I've checked to make sure they don't have anything the developer.android.com pages are missing.

You're not going to find a confident answer here. That's AGP behavior, so you'd have to talk to the AGP folks (file a bug at http://b.android.com). Experimentally from the samples CI build, AGP will install whatever your ndkVersion says in a project that uses externalNativeBuild. I don't know anything about how Flutter builds behave, so I can't help with that.

@DanAlbert DanAlbert changed the title Clarification on automatic installation of NDK on Configure NDK Path page merge wiki into developer.android.com if necessary and delete Oct 22, 2024
@gmackall
Copy link
Author

You're not going to find a confident answer here. That's AGP behavior, so you'd have to talk to the AGP folks (file a bug at http://b.android.com). Experimentally from the samples CI build, AGP will install whatever your ndkVersion says in a project that uses externalNativeBuild. I don't know anything about how Flutter builds behave, so I can't help with that.

Understandable, thanks for the prompt reply regardless. I'll check with them!

@DanAlbert
Copy link
Member

If you don't get a response (triage usually finds the right place, but not always), paste the link here and I can nudge it toward the right people.

@gmackall
Copy link
Author

Ah I ended up finding b/152075797 after some internal searching, which is essentially what I need. I'll add some comments there

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

No branches or pull requests

2 participants