which compiler to use for porting C++ through ndk? - java

I've an android app that does dome image proceesing. i'd like to write certain parts of the app in C++ for performance reason, then call these methods through the NDK. do i need a specific C++ compiler eg for embedded systems or will any do? Has anyone a link to the correct download for the compiler? thanks matt

The Android NDK comes with a compiler included, which is a version of GCC. You should not need to install any other.
Switching from Visual Studio to Eclipse will make your Android development life much easier, though. All the convenient tools are Eclipse-based.

Related

Can an Android app be developed using C/C++? [duplicate]

Is it possible to make an Android application only in C++? I don't know Java. I've tried Visual Studio 2019 approach but I guess my computer isn't good enough for emulating Android phone.
You can write code for Android in C++, if you have the appropriate programming tools. You'll need a cross-compiler and linker for the appropriate architecture. These are readily available in Google's Native Development Kit:
https://developer.android.com/ndk/
I don't know if these tools can be used with Visual Studio -- I suspect it will be fiddly to set up.
The problem with programming in C or C++ for Android is that it's hard to integrate the application with the regular launcher and, even if you can do that, it's hard to provide a regular Android graphical user interface. Android simply does not provide a C API for the user interface.
I write/port a lot of command-line stuff for Android, so the lack of a graphical user interface doesn't bother me. However, most developers provide the user interface in Java and, if parts of the app needs to be in C or C++, it gets integrated with the app in the form of a native library.
Android Studio and similar tools know how to manage a project that has a mixture of C or C++ and Java code. Using well-established Android tools for developing complex, mixed-code apps like this is way simpler than trying to figure it all out yourself using a hodge-podge of tools from different places.

Is there any way to call python code in android develop without installing sl4a?

I have found some ways to using python to build android app.But all of them need to install sl4a and pythonforandroid.
It is so complicated,so is there any way to package sl4a to my android app project,and once I install the apk,I needn't install sl4a any more.
You can use Kivy at following link :
Python for Android
It will can help u have a look to the following topic :
How can I integrate a Python code in the Android Java app?
hope this help you.
You can do this. What it comes down to is packaging the Python interpreter (compiled by the NDK) in your app, and starting it via the standard NDK mechanisms. This is the same thing that e.g. Kivy does, but you'd be adding the code to your own app rather than (like Kivy) using a java bootstrap then letting the Python manage everything else.
One option, which has seen a little discussion/development recently, is to use python-for-android to build all the python components, then copy them into your java project (and add the code to handle it). This is possible, but not currently as easy as it could be, you'd need to look into how it works internally to get the outputs you need.
Another option that is probably easier right now if you don't need compiled code beyond python itself is to directly use the precompiled python binaries of the CrystaX NDK, in which case including the python binaries comes down to only adding them to your Android.mk. You'd still need some C and NDK code to interact with the interpreter, but the process is quite straightforward.
(SL4A has some Android build tools of its own, which you could also use for this, but I don't know what you'd need to do to integrate it as I think SL4A does extra things on top of just having the python interpreter present).

Porting an SDL 2.0 game to Android

I have a game written in C/C++ with SDL 2.0, I would like to port it to mobile platforms (specifically Android and maybe other platforms too). I read SDL has a native support for Android but the game itself is written for Windows at first, although no Windows-dependent libraries/code were used. As for Android, I only used the Java based SDK before and never integrated it with native code. Which changes (if any) do I have to make to the C/C++ so I could use it on Android platform? How exactly do I acually compile the whole thing to an APK? Is it possible to use Java and C/C++ for the application, I mean, the game's activity will be the native one but the other activities (menus, settings, etc) can be written with the regular Android Java SDK?
The Android README file in the SDL source release outlines most of what you need to know with regards to porting your SDL App to Android. There's also an example project for Eclipse that demonstrates you can modify to suit your needs.
https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-android.txt
The iOS README file is also useful, namely for the sections on events and input, as much of it carries over to the Android port.
https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-ios.txt
If you need help setting up the build environment, check out this (brief) tutorial which covers installing the ADK and NDK, SDL source, building a project, programming for Android and interfacing with Java.
http://www.dinomage.com/2013/01/howto-sdl-on-android/
http://www.dinomage.com/2013/05/howto-sdl-on-android-part-2-platform-details/
(1)
I dont know anything about SDL but as long as you only make calls suported by the android NDK and what ever android supported library it should be ok. I guess you would have to set up your tool chain such that it links with SDL for android?
(2)
Yes it is possible to call c++ (ndk) from the android sdk and vice versa (see 3)
(3+ rest)
See
https://developer.android.com/tools/sdk/ndk/index.html
If you download the NDK you can also see examples of how to compile with NDK to APK

Android application launching from console

Is it possible to make a console Android app using the Android API? This application must be hidden in the package manager. Can you give me examples? In C++/Java.
Do you mean you want a console in Android so that you can type in java commands? If so, then no is the answer. Android does not have the option to use reflection. And reflection is needed to create a virtual machine where you can execute commands.
The NDK is a toolset that allows you to implement parts of your app
using native-code languages such as C and C++. For certain types of
apps, this can be helpful so you can reuse existing code libraries
written in these languages, but most apps do not need the Android NDK.
http://developer.android.com/tools/sdk/ndk/index.html
I think this is what you're looking for, but as the description says, make sure it's what you really need.

Is there a scripting language I can embed into my Java app on android

I am making a game engine that is targeted for the Android platform using Java and would like to embed a scripting language into it. I have tried Jython, LuaJava, and Groovy but none of the .jars that I include into my project to utilize the languages are working. In result, my game engine fails to run.
I am aware that the Android platform compiles the app into java bytecode and then converts it into Dalvik-compatible .dex format, since Android uses the Dalvik virtual machine. So I am quite sure that, sadly, these scripting languages likely won't work for a java app project on Android.
So my question is, does there exist a scripting language that I can embed into my Java game engine that will work on the Android platform?
Thanks.
Use DeeLang
It should work for what you are using it for or at least what it sounds like you are using it for.
ref URL: http://code.google.com/p/deelang/
Clojure would be an option - that definitely works on Android, I've even got a Clojure REPL app going on my HTC as we speak!
You might also find the answers to Java: Scripting language (macro) to embed into a Java desktop application useful.
LuaJava can be used on Android. Precisely I started with AndroLua which offers a working example.

Categories

Resources