My goal is to modify the library so I can debug it. Ideally I would be able to use Android Studio to build the library and debug the C/C++ code. So far I can build it, but I can't debug it. A programmer working at Mapbox told me they don't how to debug the Android code either, so I suspect this isn't an easy goal to reach.

I have made many different attempts to apply the Android Studio Experimental Plugin User Guide instructions, but I'm not experienced at Gradle and my latest attempt is leaving me with the following error message which I don't understand:

Gradle 'android' project refresh failed

Error:Cause:org.gradle.api.internal.ExtensibleDynamicObject

Does anyone know how to modify these files to have them build a debuggable Android NDK Library? What is causing the above error?

I am using:

> Linux Mint 17.2

> Android Studio 2.1.1

> Build #AI-143.2821654, built on April 28, 2016

> JRE: 1.8.0_65-b17 amd64

> JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

Below are the 4 files as I currently have them modified. Since I am new to Gradle, do not assume I have made any modfications correctly. I was merely attempting to apply the Android Studio Experimental Plugin User Guide instructions until I got a successful build.

Your gradle approach is essentially rewriting or porting the Android SDK Makefile to gradle. To solve what you are doing on Linux, you will likely need to modify the existing Makefiles.

The reason is that the Mapbox Android SDK build process uses make android to build the target libmapbox-gl.so. The Gradle project you have includes the .so file in with your usual Java code.

make android makes a call into mapbox-gl-native/Makefile

and also generates mapbox-gl-native/build/android-arm-v7/Makefile, which you may have to research how to modify to generate debug information as Chris Stratton mentions in the comments above.

When you do get around to modifying your C++, you will then need to modify the settings.gradle to make use of your modified .so for Android.

include ':MapboxGLAndroidSDK'
project(':MapboxGLAndroidSDK').projectDir = new File(rootProject.projectDir, '<relative-path-to>/../mapbox-gl-native/platform/android/MapboxGLAndroidSDK')
include ':app'

Another thing to consider — Can you build a debuggable version for Linux?

We have successfully debugged C++ for the Mapbox SDK using the Xcode debugger, as we built an iOS app as well. I know this will not fit your exact needs, but I mention it in case anyone else in your lab or organization has access to Xcode on OS X and can start debugging using make iproj.