Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7715875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:29:48+00:00 2026-06-01T02:29:48+00:00

As per my knowledge, there are 3 methods to compile and use C code

  • 0

As per my knowledge, there are 3 methods to compile and use C code into android.

1. NDK : by using JNI : example

2. -static : without using libc library : example

3. dynamic : with using libc library : example

I need to find out best method. Also i need to consider reliable method and require good performance.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:29:49+00:00Added an answer on June 1, 2026 at 2:29 am

    There are two ways to write an Android application that contains C:

    1. You write an Android application in Java and implement some part of it in C. You call then that part with JNI.

    2. You write an Android application in C/C++ (using the NativeActivity) but as mentioned in the first answer here you will still be calling stuff in Java under the hood.

    As far as I know, these are the only standard two ways to have an “application”, i.e. something that the normal user can play with.

    Of course, you can compile binaries using some toolchain (e.g. the NDK toolchain, or the CodeSourcery toolchain, etc.), but you can only run them from some command-line terminal or from inside some other application: these are binary code running on the device, not full-fledged applications. For some stuff, like services or drivers, that’s perfectly fine. For the static vs dynamic:

    (a) For the case of NDK, you usually link dynamically, against the basic library of Android (bionic) or any other libs that your device may have in /system/lib. This means that your program stays small.

    (b) For some other toolchain that must compile its own libc (or whatever) statically, you get a fat binary, that may load and even execute slower (but that depends on far too many factors, you should test it).

    Edit: So, in the end, it depends on what you want from your application:

    • If you want to develop standard Android “applications” that can use the GUI, the WiFi/Bluetooth, etc. use the Java or the C/C++ way, according to your language of preference. Java is more popular, so you will find more documentation and examples for it.

    • If you want to develop something in C/C++ that does not need the capabilities of Android applications (such as a service or a piece of code that interfaces to the hardware), or you want to port some existing C/C++ code, then you can just compile it with an ARM toolchain. For the differences between static and dynamic linking in general, see this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As per my knowledge, all occurrences of NULL in code are replaced by a
Per the code below, I am getting the following message. I am fairly certain
As per the question. In the debug view, there's the Variables frame. It shows
As per title, what practise for string comparisons do you use and why?
As per the title, is there PHP equivalent of __name__ == __main__ ? Is
Edit: changing .ready() call per Matt's suggestion. I use jQuery to configure some stuff
Hey there, I'm new to mySQL, so my poor knowledge of the languages might
As per my knowledge the main difference between Iterator and ListIterator is Iterator :
following is the code listed in MainClass.java. public class MainClass { public static void
As per my knowledge shared assembly can be accessed for multiple application from same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.