Debug prebuilt native library in Android Studio - android

I have an Android project using Gradle in Android Studio.
Also there is a huge C library which builds separately and then only binaries are copied to the libs directory.
Please give any tips how to debug native code in this situation. I spent a lot of time trying to find answer in the Internet but didn't find what I need.

Related

Unable to select JNI build variant after upgrading Android Studio to version 3.3

I have a Java Android project that includes JNI code written in C.
I often need to debug into the native code and before upgrading Android Studio to version 3.3 it was working.
Now in my project view I don't have any code in my cpp folder. I have confirmed that all of the C libraries are in the folder on my HDD. The CMAKE file is also missing from the project view but is also in the correct place on my HDD.
I have not changed any code from my source control since upgrading.
I am using
'com.android.tools.build:gradle:3.3.0'.
In the Build Variants section next to my JNI module I just have five dashes instead of the debug/production options.
I have uninstalled and reinstalled android studio too.
Is it possible after upgrading I need to add something to my configuration to correct including CMAKE?
I had the same issue, just figured it out. In AndroidStudio 3.3.1, they changed things around a bit I guess. Now you have to link your NDK build to the app you are building it as part of.
This is documented at: https://developer.android.com/studio/projects/gradle-external-native-builds
The section, "Use the Android Studio UI" is what you want.

How to build a AOSP project in Android Studio

I have imported AOSP code into Android Studio, on building it I am getting some internal errors but Run, Debug buttons are disabled.
The errors I am getting are:
Can anyone please help me how to resolve this error and to compile AOSP into Android Studio.
Also can anyone please help to how to convert this project into a Gradle project?
AOSP used a special format of makefile to build the whole project. If you insist build it on the IDE, you should write a plugin to index the whole makefile on your own.
Focus on something more meaningful. Review and modify the code in IDE, build it in shell, save your time.
To browse and debug AOSP use Intellij IDEA (close to Android Studio) or Eclipse.
AOSP source contains a tool to generate configuration for these two IDE called IDEGen.
IDEGen automatically generates Android IDE configurations for IntelliJ IDEA
and Eclipse. Your IDE should be able to compile everything in a reasonable
amount of time with no errors.
IDEGen README
To debug AOSP Java code take a look at this article (even though it is for Android Studio, configuration is the same for InteliJ IDEA).

Android Studio - Build Android Example projects (No Build File)?

I wanted to check out some examples, so I went to the Android training page: developer.android.com. Downloaded an example, tried to open it in Android Studio but it is not recognized as a Project.
What is the procedure to use
That's what I get in Android Studio:
Any hints? Are those examples not supposed to have some gradle files?
Ideally, those would be complete projects. In practice, not all are. In this case, you just get a hunk of Java code and resources, with no manifest and no Gradle build files.
Hence, I would use those files as inspiration for your own code in your own project.

Steps to create Android Workspace with auto build JNI C++ ".so"

I have gone through this opencv Android samples link. In this link all the projects has a JNI C++ code which builds the ".so" file automatically and build the project. I need to create a sample project like the above examples, in which the C++ code builds automatically.
I have gone through few tutorials like this, which has steps to build JNI using command line but there is no steps to build it automatically/using eclipse project.
Can any one list out the steps to create a project in eclipse that builds JNI C++ files automatically?
I suggest you can read the article Getting Started with JNI on Android, Windows and Mac. You just need to right-click on your project and select Add Native Support. Then the IDE will automatically build the .so when you save all changes.

Unable to Build MUPDF Library in Windows Envirenoment for Android

I know that there is MUPDF library available under GPL licence for rendering PDF files in android. This library contains native code. For Native code compilation we need android NDK. and CYGWIN tool.
I have Dowloaded a MUPDF library code from code.google.com site. I have also downloaded and installed the android-NDK and CYGWIN tool. I have started to build MUPDF library by Following steps mentioned on different forums.
But when i build my application by using these steps Integrate MuPDF Reader in an app
But fail to compile successfully, therefor when i run my project it's thrown exception on this line in library code
System.LoadLibrary(mupdfc);
I need help regarding this issue. I am using window XP.
Oddly enough, when you fail to build the library, the library load will fail and the project won't work.
Asking us why the library build fails without supplying any error messages or diagnostic information is unlikely to get you any useful answers.

Categories

Resources