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

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.

Related

How to convert Tasker app to native app?

Using Tasker for Android (link: https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm) and a widget-composing tool, Zooper (link: https://play.google.com/store/apps/details?id=org.zooper.zwpro ) I have automated my Android phone to automatically register certain data whenever the phone enters or leaves certain WLAN-covered areas or connects/disconnects to certain BlueTooth devices.
The registered data is kept in simple Tasker-variables and a widget simply displays (some of) the contents of those variables to the user - it is really that simple.
Together this system works like an ever running background application with an always-updated (simple) user interface (the widget).
I am so happy with what this system does that I now want to convert the whole thing into a real, yet very tiny Android app that can be download and installed from Google Play.
However, I never developed an Android app before (and not an IOS app either!). But being a professional C# developer (and former C++ developer) for Windows desktop applications and Windows services for many years now, I feel confident that I can also learn how to make such a simple Android app, even if it involves programming languages with which I’m not so confident by now (Java for example).
What I need is a few directions to get me started the right way:
Which tools do I need for making such a simple app?
Can it be done in Visual Studio, or do I need to use Eclipse or
Xamarin?
Can it be done in C# or must it be done in Java?
Do I need to buy licenses for development tools (other than Visual
Studio) or can it be done with free software?
How would you go about the whole thing?
Any input will be much appreciated!

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 any APIs that allow you to call parts of the the Android SDK in c/c++?

I wan't to build a crossplatform game for Android and iOS but I'm worried I wont be able to use the Android equivilent of Game Center and other stuff like that if I do so with something like Qt. Any way I can use these tools while still building the game in Qt?
You can use the Android NDK. See: http://developer.android.com/tools/sdk/ndk/index.html
"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."

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.

Are there such libraries that work for objective c and java? Is it possible?

I wanted to design a library/api that could work for both android and iphone development without having to make two separate libraries, is this possible? Do things like this exist?
Use this:
http://www.phonegap.com/
Depending on what you're doing, some components are sometimes written in C/C++ and compiled natively for each platform. This works on both Android and iPhone and is useful for high performance game engines among other things. Other options include PhoneGap mentioned by Jonathan as well as:
Appcelerator
Adobe Flash Builder
HTML5 + WebView frameworks like Sencha
Java on Android supports calling compiled C code through the NDK. Objective C is a superset of C. So you might be able to develop certain types of library code in C that can be called by either an Android NDK interface or Objective C API.
You can also do a user interface in HTML5 and Javascript on both platforms, so you might be able to develop an MVC app with the Model in a C library and View in a Javascript library, and just use Java on Android or Objective C on iOS as the Controller glue between them.
Use Apportable to write Objective C for both Android and iPhone.

Categories

Resources