how to write an android app with languages other than java - java

my title is a little different than what i try to say, i couldnt exactly tell what i mean.
as far as i know we develop android apps with android studio(and there were support for other ide s like eclipse before) you code it and make a gui app with drag and drop.
recently i tried to open source code of few android apps like whatsapp. i extracted the classes.dex file and checked the source code. it was written with java. but when i google "whatsapp" it says it is written with erlang.
my question is, how the code written with erlang turns to a java code? as far as i know you can make android apps with c++ too. since we dont have a translator for languages, how is this being possible?

WhatsApps backend is written in Erlang, not the app
https://www.quora.com/Is-WhatsApp-fully-written-in-Erlang
Android uses the Java Virtual Machine (JVM) runtime. To run Android apps on a phone you either need to write them in a JVM language (Java, Kotlin, Scala), or write them in another language and that has a rumtime interpreter on the device (Javascript + Android Webview, Flutter + Flutter Runtime)
You can write your app in just c++, but then you won't have any of the Android SDK available to you. You'd have to rebuild the entire view plaform (among other things). Flutter does this.
If you have more specific questions I'd be happy to answer them

Related

What is equivalent for Windows API in Android? [duplicate]

I am new to android programming and I wanted to create an application(vocabulary enhancer/words reminder which I already have for windows ) which pops up at certain time intervals to remind the words I saved earlier.
I thought android programming would be like programming windows which uses visual studio 6 or the latest.
I created a simple hello world program but it involved too many XML and other file references and inclusions.
Is there a way to create applications for android like win32 SDK using which we can create applications for windows. Like createwindows and other straight forward methods instead of having something like mfc or the one android programming uses ?
I have no idea what's "too many XML", other than a great name for a band.
If you're serious in your question, then I suggest you begin here: Comparisons of the Android framework's structure to the MFC/Win32's structure? and work your way forward.
Otherwise, I suggest you do form that band.
There is no equivalent to the Win32 API for Android. The closest you will get would be to talk to the (native) Linux OS. But that will only work if your device is rooted.
And that is the point. Something like the Win32 API would allow an Android app to do things that can interfere with other apps ... and compromise the security of the user's device.

Questions regarding Windows/Android development (Java:APK/JAR)

I'm planning to write a software (with GUI and sounds) that should run under Android and Windows 7/8
I guess the best approach for this is to use Java?
I am new to Android and Java development so my questions are:
-So can I use one development platform to create both (APK & JAR), namely Java?
-As far as I understand for Android I need to compile (from same source?) a .APK file and for Windows a .JAR file ?
(The .JAR will run in the Java Runtime that is installed in Windows)
-If I use Java what would be the best IDE, something like Google's Android Studio (will it allow to create .JAR?) or Oracle's JDK (Java SE Development Kit) ?
thank you
I don't think it is possible to write an app that will run on both OS's, since all GUI components are part of different frameworks (Android SDK for Android, SWT/Swing/... on Windows), and not compatible with all OS's.
You best bet is probably a web-based app. You can run it in the browser on dektop and either on a mobile browser on Android, or package it as a fullscreen WebView running your web app. The best part is it would also work on iOS.
You could also write your app for desktop in Swing and then convert it to an Android app, you can find questions on StackOverflow on the subject, such as this one.
Hope this helps ;)

The Bluestacks Android emulator is built using .Net?

I recently installed the Bluestacks Android emulator. I happened to look at the process running under ProcessExplorer and was surprised to see that it is a .NET application.
The HD-Frontend.exe is the Bluestacks UI process and is highlighted yellow because it has loaded the .NET framework. There are a number of other processes associated with Bluestacks and most are also .NET.
Opening the EXE in Reflector.NET also shows that it is .NET.
I thought Android was Java-based. What's going on here?
Android is Java-based, but that does not mean an Android emulator has to be written in Java -- just functionally emulate Android devices.
While BlueStack's site does not list any system requirements for its emulator that I could find, at least a couple sites -- e.g. Bazooka Apps and Android Emulator for PC -- mention .NET as a requirement.
Ultimately the proof of what's going on is right in the process list and Reflector results you found.
its an emulation tool whose job is to read the dex code respond to that how the android phone should respond and not to compile and run that dex so it could be on python or ruby also there is no boundation at all that you have to make android emulator on java becuase android is built upon java.

Is is possible to write app for iOS and move object-c code into Android?

Today I was speaking with PM. He said that the best way to solve problem "The same app working on iOS and Android" is to write object-c code for iOS and then use the same code in Android app (https://developer.android.com/tools/sdk/ndk/index.html). That approach (in his opinion) will give us DRY effect (have one code to maintain).
I was so shocked that I almost didn't say anything to it. But after some time I think about it and found some problems:
C++ != Object-C. It is possible to add o-c code as c++ code in Android?
(Let say that #1 is possible) How can I do layouts, activities, ect. in c++ for Android?
Also when we should / should not use Android NDK?
The short answer is no it's not possible. However http://www.apportable.com
Claims to enable you to compile your iOS app for Android - thus enabling you to use all of the code in your iPhone app.
However it doesn't work with everyframe work but does have hooks in to the Android SDK so you can still access those components. Worth looking at, and having a play with. I have but only half-heartly and you'd have to build the iOS app from the outset with the plan to use http://www.apportable.com as like I said it doesn't currently support all ios sdks and you'd need to work around that.
But that should answer your question.
As of 2016 app portable is no longer an option more info it appears Google killed the dream.
Objective C code will not compile with the NDK. But check out http://www.apportable.com/ it's a library that allows you to write code for Android in Objective-C. That could be what your boss was talking about.
C++ < Objective-c. Objective-c is built on top of a C compiler ... Just name the files with *.mm and write c/c++ code. Basically what you could do is write functions that you want to share across platforms in c++ and use them in an Android project via JNI wrappers.
You can not share code which uses ios system Frameworks (UIKit, CFNetwork, ...) directly.
If you want to write code for whole apps once, you could give it a shot with apportable.com, like others have pointed out.
You can use the GNUstep Android toolchain to use model code based on Foundation and CoreFoundation in an Android app, and then write a new UI layer that interacts with the Objective C model via native NDK calls on top of that (e.g. in Android Studio).

Compiling Java hardware API to run in Android.

I am a bit of a noob to Android.
I have a project that utilizes a sensor glove to input data in the from of sensor values to a device. The objective of my project is to interface this sensor glove with an Android device so that the information from the glove is sent wireleslly to the Android device where my application would do the necessary processing.
The glove came with a set of tools and APIs to program in Java with. My question is basically, can i compile my code written in java to work on the Android platform? I reference a set of Jar files in my original code. Will i be able to utilize the same Jar files when running my code in Android, or would i be able to compile the same java code to run in Android.
really appreciate the help,
If the jar contains compiled class files, it won't work. Your source code has to be compiled to work with the dalvik virtual machine, not java.
However, if you have the uncompiled class files, it will (likely) work with Android. Most standard Java libraries are also available on Android.

Categories