You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
In order to support C++ / NDK debugging in Android Studio and streamline CI builds and artifact publication we need to refactor the current make android process to integrate the Core GL C++ project files into the Gradle managed Android project. The current process compiles the Core GL into .so files based on ABI and places them into jniLibs for the Gradle build process to then use as a separate step, while the new process will copy the uncompiled C++ files into jni and make (the Gradle driven) Android NDK responsible for compiling them and linking them via JNI to the Android code along with building the SDK as whole in one step. This process will essentially mirror what is done for iOS and Xcode with make iproj where Xcode is responsible for all the compilation and linking.
Unknowns
Will custom Android.mk files be needed or will the built in NDK controls in Gradle be enough.
Will current GL Makefile process work or will refactoring to use something like Bazel be needed?
This would be really awesome when it is available. Is this already working in your local repo?
In this year's Google IO, they announced that Jetbrains NDK plugin will be available for free for Android development.
Yeah I look forward to having everything in Studio too. At one point in time (June last year) I did actually have everything built with a custom Android.mk file but a lot has changed since.
Let me know if you need help with this @bleege. First I would try getting NDK to compile all the C++ files. If we can get that to work then the hardest bit will be getting everything linked nicely.
@ljbade Yeah, it'd be fantastic to get your 👀 on this.
First I would try getting NDK to compile all the C++ files.
Agreed. It's a little unclear to me how all the C++ and related dependencies would be compiled via NDK. I assume that Mason has to stay in the mix somewhere? Can you sketch out how you think this would work on a branch?
Hmm yeah we going to need mason. Can't think off the top of my head the best way to do this.
Perhaps we are going to need to create a series of custom Gradle tasks that somehow add dependencies and etc automatically from mason command calls into the NDK settings in the Gradle state.
gradle has custom task that copies C++ files to jni dir, perhaps by calling a gyp command that does this from the gyp files (it may be better to symlink though so you can edit the files in Android Studio?)
gradle has another custom task that runs the mason setup - this will install the deps, copy the libs to the jniLibs dir and also insert the required compiler and linker flags into the NDK compile config
gradle then uses normal NDK process to compile jni dir and link with jniLibs
@kkaefer Yep. We can point the NDK at what ever path we want to. The only potential issue is if the debugger will work like this, but that's more of an unknown as Google hasn't even released it in Android Studio yet. In other words, lets worry about that later.
My big blocker is just knowing what all needs to be compiled on the C++ side. If I can get pointed at the all the C++ needed I can then get the Gradle / NDK side wired up to start compiling things.
@tomlocks We welcome PRs on enabling this functionality. The difficulty has always been trying to integrate the common C++ code that doesn't live directly in the Android project filesystem as it's reused by iOS, OSX, Qt, and others.
How can I import mapbox-gl-native Android sdk project to Android Studio like you?
@zhangzhuowh The oiginal work on this was focused on copying the C++ source code into the Android Studio jni folder but it was never finalized. This is still the current status of this work if you'd like to pick this effort up. Pull Requests are always welcomed.
Activity
bleege commentedon Jun 18, 2015
What Before and After should look like:
mb12 commentedon Jun 18, 2015
This would be really awesome when it is available. Is this already working in your local repo?
In this year's Google IO, they announced that Jetbrains NDK plugin will be available for free for Android development.
https://www.youtube.com/watch?v=f7ihSQ44WO0
ljbade commentedon Jun 19, 2015
Yeah I look forward to having everything in Studio too. At one point in time (June last year) I did actually have everything built with a custom
Android.mkfile but a lot has changed since.Let me know if you need help with this @bleege. First I would try getting NDK to compile all the C++ files. If we can get that to work then the hardest bit will be getting everything linked nicely.
bleege commentedon Jun 22, 2015
@ljbade Yeah, it'd be fantastic to get your 👀 on this.
Agreed. It's a little unclear to me how all the C++ and related dependencies would be compiled via NDK. I assume that Mason has to stay in the mix somewhere? Can you sketch out how you think this would work on a branch?
ljbade commentedon Jun 22, 2015
Hmm yeah we going to need mason. Can't think off the top of my head the best way to do this.
Perhaps we are going to need to create a series of custom Gradle tasks that somehow add dependencies and etc automatically from mason command calls into the NDK settings in the Gradle state.
ljbade commentedon Jun 23, 2015
This is my thinking so far:
ljbade commentedon Jun 23, 2015
@kkaefer How hard would it be to get gyp to copy or symlink the C++ files in the Android target instead of compiling them?
Is it also possible to capture the compile and linker flags set in gyp? Berhaps echoing them to stdout then gradle can grab them
kkaefer commentedon Jun 23, 2015
Can we get around copying the files into the jni dir by specifying the paths in a (generated)
Android.mkfile?bleege commentedon Jun 23, 2015
@kkaefer Yep. We can point the NDK at what ever path we want to. The only potential issue is if the debugger will work like this, but that's more of an unknown as Google hasn't even released it in Android Studio yet. In other words, lets worry about that later.
My big blocker is just knowing what all needs to be compiled on the C++ side. If I can get pointed at the all the C++ needed I can then get the Gradle / NDK side wired up to start compiling things.
bleege commentedon Jun 23, 2015
Internal discussion between @kkaefer and @bleege about the pieces involved with C++ compilation for Android.
bleege commentedon Jun 23, 2015
According to this bug report Android generator is being removed from GYP.
81 remaining items
tomlocks commentedon Feb 3, 2016
Bumping...
Would It be possible to get at least working Android.mk and Application.mk files with all flags and dependecies needed to build?
@ljbade You mentioned before that you successfully created Android.mk with all dependecies for older SDK version. Can you share it with us?
bleege commentedon Feb 3, 2016
@tomlocks We welcome PRs on enabling this functionality. The difficulty has always been trying to integrate the common C++ code that doesn't live directly in the Android project filesystem as it's reused by iOS, OSX, Qt, and others.
bleege commentedon Mar 24, 2016
@zhangzhuowh The oiginal work on this was focused on copying the C++ source code into the Android Studio
jnifolder but it was never finalized. This is still the current status of this work if you'd like to pick this effort up. Pull Requests are always welcomed.jfirebaugh commentedon Feb 8, 2017
⇢ #5855