Is it possible to develop for Android on Android? - java

Lately I've been doing a lot of web development on my Droid via ssh using the ConnectBot app and a few other apps for reference. I've also been doing a lot of Android development back home in eclipse, and I wondered: would it be possible to develop and test my android projects right on my phone? All I can do at the moment is either write the code via ssh and then open it later with eclipse to finish it up, or remotely use eclipse via LogMeIn Ignition or VNC. Does anyone know a native way to do what I'm trying to do, preferably offline?

Try AIDE. I use it because it supports Eclipse projects. https://play.google.com/store/apps/details?id=com.aide.ui

Not sure if this hits the target you're looking for, but The Scripting Layer for Android (formerly known as the Android Scripting Environment) is available and has a lot of power available to it.
Scripting Layer for Android (SL4A,
formerly known as Android Scripting
Environment or ASE) brings scripting
languages to Android by allowing you
to edit and execute scripts and
interactive interpreters directly on
the Android device. These scripts have
access to many of the APIs available
to full-fledged Android applications,
but with a greatly simplified
interface that makes it easy to get
things done.
Scripts can be run interactively in a
terminal, in the background, or via
Locale. Python, Perl, JRuby, Lua,
BeanShell, JavaScript, Tcl, and shell
are currently supported, and we're
planning to add more. See the SL4A
Video Help playlist on YouTube for
various demonstrations of SL4A's
features.

I found DroidScript. It's a quite powerful JavaScript interpreter thats based on the Rhino-library. It can import every Java-package and even create activities for starting from the launcher. The URL is http://droidscript.se for the Live-Editor with which you can edit scripts online and send them to your phone, and the droidscript-app has an editor, too but it cant save at the moment, i think. DroidScript is Open-Source and embeddable in an own app, I think. More info on news of DroidScript are found on droidscript.blogspot.com.

check out JAVAIDEDROID on the market

You can if you have a remote linux machine that you normaly develop on.
ssh into the machine with some ssh app.
edit the code with some console text editor (vim for example).
build the application with ant
copy the generated apk into the android phone and install it
repeat from point 2.
Good luck!

I really don't know if it's possible, but to do it, you should:
"Install" java inside Android.
"Install" ant
run ant debug
Check this link for more instructions.
PS: Please let us know if you could do it :)

Related

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).

how to write an Android app in Java which needs to use a Python library?

I want to develop an app to track people's Whatsapp last seen and other stuff, and found out that there are APIs out there to deal with it, but the thing is they are writen in python and are normally run in Linux I think
I have Java and Android knowledge but not python, and wonder if there's a way to develop the most of the app in Java and get the info I want via calls using these python APIs, but without having to install a python interpreter or similar on the device, so the final user just has to download and run the Android app as he would do with any other
I want to know if it would be very hard for someone inexperienced as me (this is the 2nd and final year of my developing grade), for it's what I have in mind for the final project, thx in advance
Instead of running it as one app, what about running the python script as separate from the original script? I believe it would bee possible, as android is in fact a UNIX based OS. Any readers could give their input on this idea an if it would work.

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.

Build Android native library with Adobe Air

I'm currently working on an Android application built with Adobe Air sdk, in AS3. I was wondering if it's possible to compile a kind of UI library that I can import in a Android native application (Java). Basically, I would like to build my UI with Adobe Air, but the main part of my application with Java, the native way.
What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen.
Is it possible? I think it may be possible, because when I don't import Adobe Air SDK in the application, I must install Adobe Air application with the Play Store to make my application working. I don't find lot of things on Google about that :s.
Thank you for your help.
Yes it can be done (in theory), but hold on to your hat, it's a bumpy ride!
I see it is a very old question, with a new bounty (the questioner has not logged on for 3 years!), but here we go...
This method goes to the heart of how android java apps are constructed and run (i.e. DEX, so it will work with adobe-air or ANYTHING, it is fundamental [general method]). (by the way you use the word native in a confusing way, native is commonly understood to mean the JNI (c++) library element of an app).
You say:
"What I have in mind is to convert the adobe air-generated APK into a
Jar file I would import in the native application project, and call
some functions that display something on the Screen."
Android programs are compiled into .dex (Dalvik Executable)[now called ART but binary compatible] files,
which are in turn zipped into a single .apk file on the device (with other things like the manifest and resources). (unzip a .apk and look inside).
A .jar file contains DEX files (zipped). (unzip a compiled .jar and look inside).
I have done some work like this before, here's a link to a tutorial and coding examples [tested by me] (in android studio + gradle) [custom build elements are usually needed (I also give an ant example)].
See my stack-overflow answer Dynamic loading of DEX files
This in theory answers your question, but it's fundamental stuff, complex and has limitations that make it hard to code and maintain (resources are a real pain in the a**e).
Question: This all seems very complicated and hard !
Yes it is ! It is an increadably silly an difficult thing to do! That is why we invented cross platform frameworks, (and for web based code javascript/css/html5...). Failing that PORT the code.
I'm more of a Flash/AS3 coder than Java so can't give you a full answer but...
A better approach might be to just render your SWF-based User Interface itself via Java code (as opposed to compiling SWF into APK format then trying to embed Flash APK inside Android APK).
This way your SWF can also communicate with Java functions (via AS3's external Interface class). Making it easier to trigger Java functions when a button on the SWF U.I is pressed etc..
You just have to find an SWF render library for Java.
Maybe check out SWFTools. Particularly the SWF Class looks promising. I have not tested this library but it might help you.
I am not a Adobe AIR developer at all, however, I have developed a few Android App with both native environment and with some kind of framework (specifically PhoneGap). So, may this can help you.
I don't think that there would be any tool which could directly convert mobile apps build using frameworks like Adobe AIR, PhoneGap or any other HTML5 based framework to a native Android app because technically it is very difficult and unfeasible to do a proper mapping between each and every element of HTML5 (or Flex element in your case) to a corresponding native control or logic. The best you can do is use plugin mechanism provided by your framework to interact with Java and vice-versa and basically that is why the framework is there. For most of HTML5 based frameworks there is a plugin mechanism which allows developer to interact with native functionality (like Background Services, Activity or any other native resource). Even these frameworks are build using the same modular or plugin based approach and there major functionality (accessing Camera, Audio, SD Card etc native resources) works like this. We have to enable that feature before using that in our app.
So, look for plugin type of mechanism in Adobe AIR.
Hope this helps.
Maybe this is a dirty way to help you, but you can :
Install the adobe air program in one computer
Copy the files of the install folder of the adobe air program
Embed all this files in the java application
Install the java application
Save the adobe air files in one folder
Start the adobe air with java (like you will do it with the console, a simple call to YourAirApp.exe)

GWT integration with PhoneGap

Edit - I know there are similar questions to this on SO, but I feel my specific questions are not duplicates at all. If you disagree with me please bring them to my attention before downnvoting or closevoting! If you can prove to me that my question is a true duplicate I will delete this question myself!
My understanding of the GWT is that it provides an SDK and API that allows you to code in Java, and it generates all the client-side HTML, CSS and JavaScript required to run a full-fledged web (or mobile web) app.
My understanding of PhoneGap is that it allows you to code against its JavaScript API and, through configuration, allows you to tell it which native mobile platforms (Android, iOS, Windows Phone, etc.) it should create nativee wrappers for. Hence you "write once, run many" with it, turning your JavaScript code into a native Android app, native iOS app, etc.
If these two assumption are incorrect, please begin by correcting me! And, if there are any caveats to these assumptions, please let me know!
Assuming my understanding on GWT and PhoneGap are more or less correct, I want to try and use them together for an app that would be available as (1) a web app, (2) a mobile web app, (3) an Android app and (4) as an iOS app.
I want to "daisy-chain" these two in my Ant build, whereby my pure Java code is converted (via GWT) into JavaScript (that complies to the PhoneGap API), and then a second build process uses PhoneGap to create and deploy:
A Java WAR (web and mobile web app)
An Android APK
An iOS binary (I believe this is an IPA file, but I may be wrong)
So with those as the "givens", here are my questions:
Is this possible? If not, why? Any way to hack- or juryrig-together a solution that forces this to work?
I've noticed something called gwt-phonegap - will I need this in order for my proposed solution to work, or would this library just be a "nice to have"? Why or why not?
Any other considerations I am not thinking of here? Other libraries or tools that would behoove me?
Note: I have heard (but am not asserting!) that Titanium is superior to PhoneGap. Titanium, however, is not free. And I am quite broke. Thanks in advance for any help here!
There is an open source project out there combining GWT & Phonegap to build mobile apps:
mgwt - http://www.m-gwt.com
There are many people out there using it to build mobile apps and there is quite a lot on documentation including videos there, especially this one:
http://www.youtube.com/watch?v=0V0CdhMFiao&feature=plcp

Categories

Resources