How to Port a C++ Project into Android NDK?

In summary, the conversation discusses the difficulty of finding information on porting a C++ project into Android and wonders how to call code from libraries in the project. There is mention of using JNI to wrap functions from the libraries in Java, but uncertainty about whether this is the best approach for a large project with many lines of code and function calls. The participants express their shared struggle with finding a solution and ask for help.
  • #1
knowLittle
312
3
Hello All,

I know that this post is very old, but I have a similar question. I believe that it is very relevant and there should be copious material on the net, but I have been unable to find it.

I am trying to port a C++ project into Android. My project uses NTL, GMP, and OpenSSL. I am able to compile this libraries using instructions on the net, but I wonder how to go about calling the code in the project.
I have seen examples that individually call a function from a library in C++. So, this function would be wrapped in JAVA JNI form.
I highly doubt that this is the way to go in porting a huge project with many lines of code in many different files and different function calls.

Any one can help?
Thank you.
 
Technology news on Phys.org
  • #2
This is a very good question and deserves to see some input, but unfortunately I don't have any good input, for I am having the same problem.
 

1. What is a C++ project in Android NDK?

A C++ project in Android NDK stands for a C++ project that uses the Android Native Development Kit (NDK) to run on Android devices. It allows developers to write performance-critical parts of their applications in C++ and integrate them with the Java code of the Android app.

2. How do I create a C++ project in Android NDK?

To create a C++ project in Android NDK, you will first need to install the NDK and set up your development environment. Then, you can create a new project in Android Studio and select "C++" as the programming language. This will generate a template project that you can then modify and build using the NDK.

3. What are the advantages of using C++ in an Android NDK project?

Using C++ in an Android NDK project has several advantages. It allows for better performance and efficiency, as C++ is a compiled language and can directly access device resources. It also enables code reuse, as C++ code can be used across multiple platforms. Additionally, C++ offers more control and flexibility for low-level operations compared to Java.

4. Can I use any C++ library in an Android NDK project?

Yes, you can use many C++ libraries in an Android NDK project. However, not all C++ libraries are compatible with the Android platform, so you may need to make some modifications to the library or use a wrapper library specifically designed for Android.

5. Are there any limitations to using C++ in an Android NDK project?

While using C++ in an Android NDK project offers many benefits, there are some limitations to be aware of. The main limitation is that not all Android devices may support all features of the C++ language, so you may need to test your app on multiple devices. Additionally, debugging a C++ project in the NDK can be more challenging than debugging a Java project.

Similar threads

  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
1
Views
592
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
923
  • Programming and Computer Science
Replies
1
Views
3K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
30
Views
4K
Back
Top