How to run Java code on Android device without uploading apk - java

Is there an easy way to run Java code on an Android device without actually delivering an apk? I'd like to test out function calls without building an entire project.
For instance, it would be cool to run calls like Camera.open(1) and see what the device responds with. It takes forever to rebuild an entire project and redeploy it for minor changes. The only option I can come up with is having some sort of text field that takes user input, executes commands (Compiler API?) and displays the result. Is there a better way?

There is the Android Scripting Layer
https://code.google.com/p/android-scripting/
There is Dev Apps Direct for looking and loading sample open source libraries.
There is API Demos which is just the official samples from the android sdk that a third party published on Google Play

Related

Uploading files in google colab

So I am writing code in java in google colab because I want to copy-paste the code in android studio to perform a specific function. Now in python it is pretty easy to upload files to google colab but I want to do it in java (I particularly want to upload image files). I should be able to upload image files in such a way that I can use it as input in my code. How can I do it? Also, for all the packages that I import in google colab, will I have to separately download them for android studio or can I just copy-paste the code and it will run?
Google Colab presents a Jupyter-notebook like environment for Python code only. It cannot run Java code (at least, I cannot find where you'd make it do that).
I want to copy-paste the code in android studio to perform a specific function
Android code runs on an Android device, not in a server.
If you want to run Java code on a server, then you'd host an HTTP-based Java web-server that you use an HTTP Client from Android app to communicate with it. (In theory, yes, you can install and run JAR files in Colab, but you would then need to know the IP of those servers in order to connect with them).
The more appropriate solution would be to use Google AppEngine or GCE/GKE (assuming you want to use Google Cloud)
I ... want to upload image files
You can use the Java Google Drive SDK for that
for all the packages that I import in google colab, will I have to separately download them for android studio
Android Studio is an IDE. Gradle will download packages for compiling your Java/Android code, yes, but as mentioned, Colab is downloading Python packages, not Java

How to make an Android app without using Android Studio?

I downloaded the Android studio and installed it. When I launched it, it's all "graphical". My screen reader is reading nothing on it.
I'd prefer if I could use my Notepad app, but the "stand alone" tutorials are too tiresome, and not many tutorials on the web have instructions making apps using Notepad. I wanted to know if there is an alternate IDE, or another way to code Android apps?
The Java IDE Eclipse is also not very compatible with my screen reader. I use JAWS screen reader by Freedom Scientific. I used to code Java desktop software using my Notepad, so I'm familiar with programming using Notepad.
Also, if I somehow figure out how to make Android apps using Notepad, how am I going to test them? Do I need a phone? I'm sorry for all these beginner questions, but I'm a beginner :)
You can follow this link:
http://developer.android.com/tools/building/building-cmdline.html
If you only want to build, not run, you don't need a phone. If you want test without a phone you can use an emulator by running"AVD Manager.exe" in Android SDK folder.
The good thing since the transition to android studio is that now the building of an android project is done using Gradle and can be piloted entirely by command line. So technically, you don't need an IDE at all.
Basically, every project has at least a build.gradle file that contains the instructions to build it. You only have to launch Gradle with the appropriate command to compile your app.
Yelliver mentionned the tools to build the app from the command line, there are also tools to create the project structure and the basic build files: http://developer.android.com/tools/projects/projects-cmdline.html (this documentation appears not to be entirely up-to-date, though, as it mentions the old project.properties format)
Having a phone to run your app is certainly going to be nicer and faster to develop. The emulator is far from perfect, quite slow, and sometimes not responsive. It is also easier to install other apps on your phone than on the emulator, in case your app interacts with other apps.
I wrote two small scripts for Android development without using Android Studio. They are building apk and installing it on the connected device and opening the logcat with the output of the installed application. This two scripts not even near to complete when to think all the features of the Android Studio but they are allowing to at least run the project on your phone.

How to run Java app in Android

Is it possible to run java app (jar) in my android application? Because I need to create PDF, the problem is if I generate PDF in android, only can show with small image, if it contains large image in many pages, it will be error. So I think, I can generate PDF in java and then included to android app.
Concernig the mentiones app JBED:
Well honestly, I could not find any credible source for this tools JBED, so I would really be very cautious (e.g. who is the developer?)
In the manifestfile (in Androidmanifest.xml, where every app has to state what rights it needs to run, see How to view AndroidManifest.xml from APK file?) there are many rights mentioned (what could be necessary, as the app wants to run as an emulator), so a java application might want to send an SMS, record audio, take pictures and place calls -- so the emulator would need those rights as well.
But then the app also registers the "android.intent.action.BOOT_COMPLETED" event (i.e. autostart after boot) and this would go against every description of the tool.
Ah yeah and giveaway: The apk has a folder "certs" that has some (root-)certificates. But those are not the real certificates of the authorities, e.g. Versign. If one installs the app and by that those certificates the trust you might have in https-connections is lost because those who made the fake certificates can create own, false certificates that your phone would trust.
I assume (or am pretty sure) this is a spy tool, but I could be wrong. The (rare) testimonials that claim the tool ran perfectly will probably be the same person that posted the tool under a different name.
Andreas
You can import java Third-party libraries into Android app, follow the steps here.
I am not sure whether it will work,but just try.
If your program is a console program, the answer is yes.
Install Jvdroid from Google play. Click terminal and then write this command: java -jar YourJarFileName.jar
The simplest way would be to some install terminal emulator and then install java and then you can run java apps on standard java. You can even install full Linux distro with x server without rooting the phone, then connect to it from x client and you have Linux desktop on android. Once I've even installed eclipse for java development on it and everything worked. I tested this setup last time in 2014, but I'm pretty sure you can do this nowadays as well. The app with Linux I get from play store as well app for the x client. The app I used back then was "Debian no ROOT" or smthg like this. You need to check what's currently available to make this setup in Google Play store according to your android version and your preferences. Last time I've checked there was a lot of different tools for this kind of task. Lastly I've even successfully installed TF and keras on my android phone using terminal emulator.
You can use JBED. JBED is an .apk Android application which run java games and app on your android Device. JBED is a java android emulator, by using
this application we can install .JAR/.JAD/Java/J2ME/MIDP app on android phones.
You can do it quite easily as there are many ways to run java apps on android. Specific application called Java Emulators can do it quite easily.
These are four most popular java emulators for android viz, JBED, PhoneME, Jblend and NetMite. These are arranged in order of their preference. You can use phoneme for non rooted device, however if your device is rooted try any of the remaining three applications.

Run Android APK files in web browser - Is it possible?

I am looking to write a web page that can load to it and run APK files. Something like a web control that can get an APK file url, load it and let the user interact with the app (No need in the whole android system, just the specified APK).
Is it possible? Is there anything like that in the market? Maybe a standalone open source emulator i can migrate to work on the web?
Short answer: no, but not fully impossible
Long answer: BlueStacks provides a raw and unstable emulation framework that is able to run single APKs without the full Android device emulation, but while it's not designed to run in a webpage, it actually executes as an ActiveX.

Java Application on Smartphone

What alteration should be made in a Java Application to be able to install it on Java Enabled Smartphone?
I tried using a random app of mine to see what happens, when I open it on the cell, it says Install? I say yes, and it says invalid file.
Now I was wondering what alteration should be made?
My smartphone (Samsung S8500) runs on bada which is more or less the same as Android, but alterations in the General.
You need different SDK for smartphones. Like for Android, you need Android SDK 1.5 or any other version. You just cannot install the same application. You need to develop using the resources provided by the SDK.
If your application is Java based mobile application then you can use some tools to convert it for Android. Doesn't work every time but worth a try.
In your case, Bada OS is not like Android what i learn from here. So, you need to develop the application using J2ME .

Categories

Resources