In my Android project, using the latest Gradle build tools, I have a single file with native C code and a few simple function. The only thing included in the C file is string.h and jni.h and the functions simply return String and primitives. The file is placed in the jni directory besides the other source folders (java, res etc.).
When I build the application, it compile the C code, generates the .so file and includes it in my APK. The problem is that the .so file has ALL symbols stripped.
When inspecting the intermediate .so file placed in build/intermediate/ndk/obj, all the symbols are still there. So somewhere after the first .so file is generated and when it gets packaged, everything is stripped.
When building the .so file using the command line ndk-build, everything works fine and the symbols are included.
Is it a bug in the Android Gradle plugin (I'm using the latest!) or am I missing something?
When Gradle is unable to communicate with the Gradle daemon process, the build will immediately fail with a message similar to this: $ gradle help Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details FAILURE: Build failed with an exception.
“build. gradle” are scripts where one can automate the tasks. For example, the simple task to copy some files from one directory to another can be performed by the Gradle build script before the actual build process happens.
Build types define certain properties that Gradle uses when building and packaging your app, and are typically configured for different stages of your development lifecycle. There are two build types defined by default, debug and release , and you can customize them and create additional build types.
The symbols are in : src/main/obj/local so add to build.grade :
android.sources {
main {
jni {
source {
srcDir 'src/main/none'
}
}
jniLibs {
source {
srcDir 'src/main/obj/local'
}
}
}
}
then go to Debug Configuration-> Debugger and add to Symbol directories: app/build/intermediates/jniLibs
after that I was able to debug my native code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With