This is more of a theoretical questions, one which I may not have thought through properly, but is it POSSIBLE to compile an Android app ON an Android device?
As in, write up the sourcecode on the device, compile, test and deploy it, without having to use an other OS for any part of the process?
In theory, yes. In practice, this is a lot of work. Compiling an android app involves a lot of separate tools, like the full-blown JDK, and a lot of other tools sign the resulting JAR and package it into an APK. That would have to be ported to Android, which is a major undertaking.
Related
I want to develop an App that makes use of some heavy C++ code.
From what I have understood, I have two choices.
Build the library outside Android Studio and then import it, or put the C++ source code directly in Android Studio to let it build.
If I choose to build the library Outside Android Studio, I can use (OW): Windows or (OL): Linux.
At the same time, I know I can run Android Studio on either (AW): Windows or (AL): Linux.
My question is, can there be any performance difference in the App product running on the phone, depending on a specific approach I would follow (OW+AW/OW+AL/OL+AW/OL+AL/AW/AL)?
To integrate a C++ library into your Android application, from the performance point of view there's absolutely no difference. The difference in all those your mentioned options is the build process of your C++ library (the files with .so extension, i.e. shared library) which will be later integrated into your final .apk executable file. The Android NDK is doing everything at one place, but aside from performance, you should also consider other factors like development and testing capabilities, based on your project and your (and your peers') active skills. Speaking of the performance, it mostly depends on the number of calls between Java and C++ parts - the less data goes back and forth the better for the performance.
OK this is a strange one:
Is there a way someone can develop native C applications or libraries for Android without using the Android NDK?
What was happening before the NDK was released?
(It's not there for too long, I think it was released only one or two years ago).
Apparently, you can -- a friend of mine is a real Android guru and he managed to build a GCC-based native toolchain entirely by hand. He also fixed some missing parts in Android's libc. The main idea is the following: GCC has builtin support for the arm-elf-linux target, so with an appropriate build script, you can configure it to build for Android. However, you have to root the phone to run the resulting binaries. One even cooler thing is that because GCC is a self-hosting compiler, with the arm-linux-elf toolchain, you can recompile GCC once again and have the toolchain on the phone itself.
Before the NDK was released, the only officially supported way of developing Android applications was to use the Android SDK and writing your applications in Java.
As others have mentioned, it's possible to cross-compile some applications as completely stand-alone and run them on a rooted phone. The downsides of this should be obvious: very few people will be able to run your application (they also need to be root, plus you won't be able to get your application up on the Play store); and you might even run into compatibility problems yourself across different devices e.g. if you rely on dynamic linking against various libraries (which you might need to do in order to keep the size of the binary down).
TL;DR: it's possible, but severly limited, and not recommended.
You can compile your C code with an Android-compatible toolchain (such as CodeSourcery) and run it on a non-rooted phone, from its command line (for example through an SSH connection like SSHDroid).
I've started learning Scala, and I... I think I'm in love. I've only coded small test snippets so far, but since I currently working in Android development, what I really want to do is try my hand at writing Android applications in Scala.
I've found articles and questions on the matter, but mostly referring to older versions of the three tools (Android SDK/Scala/Eclipse), so the general question is:
Is anybody coding Android apps in Scala right now, with the latest SDK, Scala 2.9 and Eclipse Indigo? How viable is it?
And, in particular:
How's the interaction/integration between Scala's features and the Android library?
What's the state of the Scala plugin for Eclipse? I've read all the features you'd expect are there, but I'd like to know first-hand stories, specially about the debugger.
How well does the build process (scala to java to dalvik, ant, proguard, etc.) automate?
Thanks!
We are using Scala heavily to test our Android code - you can read a writeup of how we're doing so here. We use Ant or SBT to compile - there's an excellent SBT plugin for Android development.
Having said all of that, I'm not sure that I would recommend Scala for production Android development. In particular Scala 2.9.x is basically unusable as there is no good way to get the libraries to work on Android. You can read about the issue here.
It's a real pity, as Android development would benefit considerably from Scala if we could get it working properly.
Solution found here to use the latest Android SDK, with Eclipse 3.7.2 and Scala 2.9 :
https://stackoverflow.com/a/11084146/1287856
It completely handles the android library
You can make Android Library out of scala projects as usual
The build process is completely automated, including proguard-ing and exporting the project with the regulard Android tools.
I started to implement the android application (a twitter client) from the book "Learning Android" with Scala 2.9.0-1 a while ago.
In my opinion you can use it. I had only one problem with the parameter list at AsyncTask (see this link, problem #3).
If you want to checkout out the project, you can find it here.
This video from ScalaDays 2011 may be hepful:
Scala on Android: Real-world Experience at Bump Technologies by Michael Galpin
EDIT:
If you really really want to run Scala code on Android (and not really make an app, but for yourself), then I have an easier solution. It depends on if your phone supports the procedure. In summary the steps are:
Install Ubuntu on your device (as described here). This will not affect the Android installation.
Boot Ubuntu, install JDK, Scala, etc, copy your Scala jars and run from there.
I'd like to learn Android app development but I don't want to use any IDE, especially Eclipse and its ADT plug in. It's just that I'm more comfortable with command line, executing commands myself and seeing what's going on beneath. I'm looking for a good reference/tutorial/ebook/walk through on the flow. Is there any such resources available?
From the android dev. website: http://developer.android.com/tools/building/building-cmdline.html
Ofcourse the title suggests using a different IDE, but it explains what directories you need, how to compile your .APK etc.
Ofcourse, you need de SDK and the tools from there, but that's a given. You can however use the above information to develop without Eclipse/ADT
I have seen questions and topics in google referencing running JRE apps in the android environment, but I am actually thinking about the reverse.
I understand Android runs on a different runtime engine than the standard JRE.
Is it possible to build an app to run on android, but also build and run the same app in the JRE on a desktop?
I assume there would be restrictions on API usage, I was just thinking about the possibility to distribute a simple app that could be useful on both the device and the desktop.
I think the bigger problem here is going to be accessing the Android API and environment on your desktop. Do you have a plan for that?
If you have the Android environment running on your desktop then there shouldn't be any problem running your app there.
This answer offers an alternative suggestion.
Short answer: your desktop and Android app can share a large portion of code, but you aren't going to be able to run Android-specific code on the desktop.