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.
Related
I've installed and set up Java JDK 17 as well as Android SDK (the manual way) on my Ubuntu 22.04.
From there, is it possible to develop an Android application in Java WITHOUT Android Studio ?
Developing through the command line or through a light IDE is fine by me, but there are very few guidance and information out there.
Thanks to enlighten me.
Sure you can! You'll need to type an awful lot of stuff though, that Android Studio does for you automatically:
You'll need to create gradle files to build your project, you'll need to create an Android manifest to describe your Android components and your app (permissions, themes, target SDK, etc.).
You'll need to create the code files containing your Android components (Activity, Fragment, Service, BroadcastReceiver, etc.). You'll need to create all your UI definition files in XML (layouts and other resources).
Then you can use gradle on the command line to run all the necessary preprocessors, code generators, compilers, linkers, resource builders and package builders to give you an APK which you can then install on your device for testing. And you can debug by writing lots of stuff to the logs and using adb commands to get the logcat off the device to see the log messages, exceptions and stack traces.
I have written a huge java programm (about 6000 lines of code including UI) with javaFX. I decided to convert this project to a flutter project to be cross-platform and make it look nicer. My idea was, that I could just use my Java logic in the flutter project, which actually works pretty easy via MethodChannels in the android directory of a flutter App, but here is my question:
Does this android directory in the flutter project make the project only viable for android (as long as I dont make a similar version for iOS)?
Is there any other way to use my android code other than this android directory (maybe in the normal lib directory)?
Edit: Reworked my questions to make clarify what I was asking for
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
I copied the program from this link: Memo Game and turned it on on Eclipse. Everything worked properly. What if I want to try it on my Android device? I download BlueStacks and exported Eclipse project into Runnable JAR file. Then I tried to turn this file on using this guide but I couldn't do it. I found the whole process very difficult and I am sure there are easier methods to write Android applications.
Main question: What should I do in order to turn on a normal Eclipse application that I write and test on my computer on Android? Is it at all possible?
I know that there is a program called Android Studio, but there you use specific commands that I am not familiar with. That's why I am asking about turning on the same code I write on computer but on Android.
I am developing an android app that processes images. I tried android ndk before so i can code natively to speed up performance. But I discontinued using it because I can't fully understand the C language.
So I continue my app dev using Java code. I searched for easier and better solution to speed up the performance of my app without using native code and it was a success.
After sometime, i realized that the ndk wasn't remove from my project. I removed it and recompile my code so i can remove the cpp folder too. But when I test my app, it became very slowwwwww... I linked the ndk again and now the image processing is fast again.
My question is, how did that happen???
For processing images, usually C/C++ gives better image output than Java in desktop.
While programming in Android also i saw C/C++ Android NDK code gives better image output and faster than Android Java code.
This may be because of C/C++ code directly complies to native code where else java compiles to byte code and from byte code complies to native code by JNI.
And in NDK, .so files are created by Application Binary Interface(ABI) by that application machine code is directly interacted with the system at run time.