See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1

    C++ and Android App

    What are chances that one can create a C++ app to run on android? What are requirements?

  2. #2
    Member
    Join Date
    Jun 2011
    Location
    FL, USA
    Posts
    10

    Device(s)
    HTC G2
    I don't think you can develop only in C++. I worked on a project, though, where a team gave me a shared object file (which they wrote in C++) and a jar file that I incorporated into my Android project. I could then make calls into their library from my Android/Java code.

    Android has a Native Development Kit (NDK) for developing in other languages. I suggest you read up about it and look for some tutorials.

    http://developer.android.com/sdk/ndk/overview.html

    -badtea


    1 members found this post helpful.

  3. #3
    Quote Originally Posted by badtea View Post
    I don't think you can develop only in C++. I worked on a project, though, where a team gave me a shared object file (which they wrote in C++) and a jar file that I incorporated into my Android project. I could then make calls into their library from my Android/Java code.

    Android has a Native Development Kit (NDK) for developing in other languages. I suggest you read up about it and look for some tutorials.

    http://developer.android.com/sdk/ndk/overview.html

    -badtea
    I want to try to make a port for wxWidgets for UI widgets. Do you have any idea how can I make a button with a label using NDK?


    Last edited by evstevemd; 06-20-2011 at 11:19 AM.

  4. #4
    Member
    Join Date
    Jun 2011
    Location
    FL, USA
    Posts
    10

    Device(s)
    HTC G2
    No, I'm not sure if you can use the NDK to create UI elements. Creating a button with a label is pretty simple using Android/Java though. Are you saying you already have a C++ application that uses wxWidgets and you want to get in on Android? The NDK might help but I think you still need to create your UI with Android/Java.


    1 members found this post helpful.

  5. #5
    Quote Originally Posted by badtea View Post
    Creating a button with a label is pretty simple using Android/Java though.
    I left Java long ago and not sure If I want to fully return soon

    Quote Originally Posted by badtea View Post
    Are you saying you already have a C++ application that uses wxWidgets and you want to get in on Android? The NDK might help but I think you still need to create your UI with Android/Java.
    No, I want to extend to add simple Port for android if it won't be complex. What would you suggest?


    Last edited by evstevemd; 06-20-2011 at 01:35 PM.

  6. #6
    Member
    Join Date
    Jun 2011
    Location
    FL, USA
    Posts
    10

    Device(s)
    HTC G2
    Quote Originally Posted by evstevemd View Post
    No, I want to extend to add simple Port for android if it won't be complex. What would you suggest?
    My gut feeling, without knowing too much about the NDK or wxWidgets, is that it would be complex. I just don't know if you can make a UI any other way besides getting into Java/XML.

    Have you worked with Android before? If not, I suggest getting familiar with Android by doing the Android Hello World. Then download the NDK and read some of the NDK documentation and you may get some ideas about how to do it.


    1 members found this post helpful.

  7. #7
    but are you guys sayin that this is not possible?



  8. #8
    Quote Originally Posted by badtea View Post
    My gut feeling, without knowing too much about the NDK or wxWidgets, is that it would be complex. I just don't know if you can make a UI any other way besides getting into Java/XML.

    Have you worked with Android before? If not, I suggest getting familiar with Android by doing the Android Hello World. Then download the NDK and read some of the NDK documentation and you may get some ideas about how to do it.
    I have so long worked with wxWidgets and I'm a bit comfortable. I have worked with Java previously too but never with android. I would try some android before trying what I think of. Thanks!

    ---------- Post added at 07:59 PM ---------- Previous post was at 07:59 PM ----------

    Quote Originally Posted by Nathan7529 View Post
    but are you guys sayin that this is not possible?
    No body said that



  9. #9
    Member
    Join Date
    Jun 2011
    Location
    Ky
    Posts
    6

    Device(s)
    Motorola Droid (original)
    The only way I have ever known of to create any kind of UI in native Android code, is to use OpenGL or SDL. Or by using the Java UI objects in your actual C++.

    wxWidgets *may* work if you edited its source code specifically for Android and then cross-compiled it for ARM... (that's one big *maybe*). I would say this would require lots and lots of adjustments though.


    1 members found this post helpful.

  10. #10
    Quote Originally Posted by snfo View Post
    wxWidgets *may* work if you edited its source code specifically for Android and then cross-compiled it for ARM... (that's one big *maybe*). I would say this would require lots and lots of adjustments though.
    Would you explain a bit what you mean and what is ARM. I'm very new when it comes to Android specific terminology!



  11. #11
    Member
    Join Date
    Jun 2011
    Location
    Ky
    Posts
    6

    Device(s)
    Motorola Droid (original)
    Quote Originally Posted by evstevemd View Post
    Would you explain a bit what you mean and what is ARM. I'm very new when it comes to Android specific terminology!
    ARM is the machine architecture used by almost all the Android devices out there. Just like there is x86 and x86_64 (which is probably what your desktop machine architecture is). You need to recompile C/C++ code for each architecture you intend to use it on. wxWidgets would need to be cross-compiled for ARM before you could use it on an Android device.



  12. #12
    Quote Originally Posted by snfo View Post
    ARM is the machine architecture used by almost all the Android devices out there. Just like there is x86 and x86_64 (which is probably what your desktop machine architecture is). You need to recompile C/C++ code for each architecture you intend to use it on. wxWidgets would need to be cross-compiled for ARM before you could use it on an Android device.
    Sorry for being stubborn, but would you enlighten me on how do I write a wrapper for C++, the compilation process until getting executable running on Droid devices?



  13. #13
    Member
    Join Date
    Jun 2011
    Location
    Ky
    Posts
    6

    Device(s)
    Motorola Droid (original)
    Quote Originally Posted by evstevemd View Post
    Sorry for being stubborn, but would you enlighten me on how do I write a wrapper for C++, the compilation process until getting executable running on Droid devices?
    I honestly wouldn't be able to help with the gritty details of this process.

    I'm just trying to tell you what this project would most likely involve if you attempted it. I would suggest reading up on the JNI. This will help you with writing Java wrappers for native code. Also, try reading up on GCC's awesome cross-compiling abilities.

    No matter what though, in order to reach the most Android devices out there, if you wrote an app like this it would probably not end up with a native executable. What you need is to create a shared library (a libsomething.so), and then load and call it from Java within your APK.


    1 members found this post helpful.

  14. #14
    Quote Originally Posted by snfo View Post
    I honestly wouldn't be able to help with the gritty details of this process.

    I'm just trying to tell you what this project would most likely involve if you attempted it. I would suggest reading up on the JNI. This will help you with writing Java wrappers for native code. Also, try reading up on GCC's awesome cross-compiling abilities.

    No matter what though, in order to reach the most Android devices out there, if you wrote an app like this it would probably not end up with a native executable. What you need is to create a shared library (a libsomething.so), and then load and call it from Java within your APK.
    thank a lot. somehow I have got idea of what it might involve



  15. #15

    Reply to post

    Quote Originally Posted by evstevemd View Post
    What are chances that one can create a C++ app to run on android? What are requirements?
    First off I have to let you know I am by no means an authority on this subject. I am a nub at programming I am learning C++ as a first language and at the same time learning Eclipse's ide (for Android app dev) so that I can build Apps for mobile phones. So with that said I shal get movin' on with it...

    From my understanding and based on the plugins that I have found you can write an app in C++ and port it to the Android platform. If you don't have it already get Eclipse (Juno is the one I have and at the time I got it it was the latest version [downloaded June 2012]) here's the link Eclipse for the download page. You can use the built in plugin and software installer that comes with the ide by selecting the "help" drop down menu and click "install new software". Note: for some plugins you will have to add its URL and type in the name of the repository in order to find and install the plugin you want. I had to do this for ADT (Android Development Tools) Name = adt plugin URL= https://dl-ssl.google.com/android/eclipse/ if the https site doesn't work then replace with http instead and that should work. As far as I have found all the plugins that you need concerning the use of C++ can be gotten from the repositories that are listed with the install if yours for some reason doesn't have them already here is the info for those Name = Juno URL = http://download.eclipse.org/releases/juno I hope this helps. You can also get a set called NDK click the link for a description on it. From what I read about it in most cases you won't need to use it. Also of note is that whereas for most software development concerns where writing programs in C++ will give better performance this does not always translate in regards to programs (apps) written for Android. So if performance is your motivation for writing Android apps in C++ you may want to research on whether or not there is a benefit. Huurrmppff...

    On another note if you are a nub like myself and or want to collaborate on a few ideas I have for apps (and your own ideas too) I would like to hear from you. I am not (at present) working for any software company and am learning all this on my own. If you are in the same boat as myself or at least on your own while working with me if you choose to. The last thing I want is for my ideas to be ripped off by a company because I collaborated with one of their employee's. Not that I have stars in my eyes and think that every idea I have will turn into the next Angry Birds but I do hope to make a couple of bucks if I can.

    Anyway enough rambling and if anyone reading this fits into what I am looking for please let me know if you are interested.

    "OH AND IF YOU ARE ASKED TO LOGIN OR REFRESH THE PAGE MAKE SURE THAT YOU COPY AND PASTE YOUR POST TO WORD OR NOTEPAD BEFORE YOU DO OR ALL THAT TYPING WILL AMOUNT TO NAUGHT. I KNEW TO DO THIS BECAUSE I HAVE HAD A REFRESH OR RE-LOGIN TOSS MY STUFF BEFORE"



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •