Build/Package Android application with rake? - android

Is it possible to build an android application with rake? The only other question on this subject I saw was a while back and someone advised using Gradle.
So is there any way to do this on the command line, as I am sure under the hood eclipse just runs a lot of command line guff to get the apk file generated then spits it to the device, I just want to generate the apk file (there is alot of other things to be done but these are prior to the APK building).

Is it possible to build an android application with rake?
Yes, insofar as it is possible to build an Android application using Ant, and rake can in theory do everything Ant can.
If you are expecting to find an existing rake script, though, you will likely be disappointed. The Ant scripts necessary to build an Android app are rather substantial, and porting all of that to rake will take quite some time. And, then, they will perpetually be out of date, as those Ant scripts are often modified with Android tools releases.

Here's a small example project that's worth a look: https://github.com/jberkel/android-helloworld-rake
I've been meaning to try it out myself.

Related

Is there apktool on Android? I want to assemble ".smali" and make new ".apk" in an Android application

I want to assemble ".smali" and make new ".apk" in an Android application. I don't have so much time to do this so I have to use some source code that already exists.
There is an Apktool project which can build on Windows/Mac OS X/Linux, but I want to build it on Android.
I also tried to include the "apktool.jar" as an external library in an Android Application Project in Eclipse, but it failed.
After some research, it seems more clear that I need only the following two projects running on Android:
Smali (independent project)
JarSigner (from OpenJDK)
And, Apktool is not necessary.
This project has what I need:
https://code.google.com/p/java-ide-droid/
Requirements
JRE 1.6 (Java Runtime Environment)
aapt command in a PATH
basic knowledge of what is SDK, aapt, PATH, smali and Google search engine may be useful
This is from the apktools official website. Because it needs aapt, it seems quite hard to use apktools in an Android app. But if you can get the source code and compiled in an aosp environment, it could possibly make it run on the Android side.
Yes, there is a program also named apktool, but which runs on Android! Just have a look at http://code.google.com/p/apktool.
As of 2022, Yes there is a mobile version of Apktool, it is however not developed by iBotPeaches it's developed by Maximoff.
It's called Apktool M, you can grab the latest stable version from the link below.
https://maximoff.su/apktool/?lang=en
As far as stability goes it's definitely stable for Android 12 as far as I've tested.
Because I'm also a security freak, I ran it through about 7 different AV scanners to make sure I wasn't installing some hogwash virus masquerading as a legit app, and all of the scan results returned nothing malicious.
As far as usage goes it definitely decompiles APK's like Apktool as far as I've tested, however I don't expect it to work on every APK though.
According to the documentation,
Apktool M uses the following open source projects:
Apktool-android
aapt, aapt2
Commons IO
Apktool
antlr4
apksig
smali, baksmali, dexlib2
guava
jadx
textwarrior
axml
unapkm
imagetracerandroid
ZipAligner-for-Android
Dex2Jar_Android_2x
AndroidX
AndroidSVG
PhotoView

can i compile android project without eclipse?

Hello there is one question which comes in my mind from last 2 days. Can we compile our android project without Eclipse? If yes then what is alternatives? Please share it.
one option is ant, and an extremely reduced tutorial goes like this:
first update your project with a proper build script and all the files that ant needs, you can do that with just one command, for example
android update project -p . -t android-10
this command has many options, feel free to browse for those options.
after that just do
ant debug
or
ant release
depending on what you want to produce, again, ant has other variations and you can easily discover them with the Android docs.
If you are developing in a non-Eclipse environment, you can build your
project with the generated build.xml Ant file that is in the project
directory. The Ant file calls targets that automatically call the
build tools for you.
Look at Here for more details.
cd /path/to/my/app
ant release
it will ask you every time for your private key to sign the app, it can be configured to auto-sign by editing "build.properties" file:
key.store=release.keystore
key.alias=release
key.store.password=my_key_password
key.alias.password=my_key_password
you can also investigate Android SDK, find the ANT build scripts it actually uses, and insert your custom obfuscator/optimizer call in middle of build process.
For people that are not used to coding in java and want to use HTML/JavaScript and CSS to build native apps for android -- you can use PhoneGap -- you can upload your code in a zip and get an APK. Currently its in beta, and thats why free.
https://build.phonegap.com/
Other Phone OSes are also supported. Its pretty interesting.
You can use maven with the maven android plugin http://code.google.com/p/maven-android-plugin/. Afterwards you can use any IDE that supports maven (NetBeans, Eclipse, IntelliJ IDEA).
If you just do not want to use Eclipse IDE you can choose other IDE like IntelliJ IDEA.

Getting started with JUCE for Android

I need to start building an Android app that uses the JUCE libraries. I'm reading the web site and trying to figure stuff out.
I tried installing JUCE on an Ubuntu 11.04 system, and when I built the IntroJucer app, the menus don't work right (they flash open when I click with the mouse but then disappear). Can a JUCE app for Android be built on Mac OS X, or even Windows?
If you are using JUCE to build Android apps, please give me any advice you can.
Yes, a Juce app can be written for Android using either OS X (XCode 4) or Windows (Microsoft Visual Studio 2008 and higher). You also have the option of using the Eclipse IDE on either platform.
At the time you posted, Juce was undergoing a major overhaul and the IntroJucer might not have been as stable as it needed to be, especially on systems other than OS X or Windows. You should look into it again. IntroJucer is not required to build a Juce Application (although it can make things easier).
I suggest you first build the Juce Demo application for your platform. If Ubuntu is giving you trouble, try OS X or Windows first. Once you have the Juce Demo running you can move on to IntroJucer. If that works, then try compiling Juce Demo for Android. Your questions can be answered in the Android Juce Forum:
http://rawmaterialsoftware.com/viewforum.php?f=13
Here is what I have figured out now that I have been working with this stuff for a bit.
All of this is based on the most recent "stable" release of JUCE, which is about ten months old as I write this. It is quite possible that things have changed (for the better!) in more bleeding-edge releases of JUCE, and when I get a chance I will try a newer JUCE.
The best platform is Mac OS X. When I tried Linux I had some issues with Eclipse not working; I still prefer Linux so I'm going to go back and try again, but on Windows and Mac I had no Eclipse troubles.
Start by installing the Android SDK, and running the updater to grab all the updates. Also install the Android NDK, and Eclipse. In Eclipse, install the ADT plugin.
JUCE sets up an Ant build file that will build all the C++ code for you, automatically. You need to not mess with this. I had a problem where there was a task called "setup" and Ant didn't know how to resolve it; the solution was to delete the "setup" task and not touch anything else. When I was trying to figure out how to solve this issue, I found suggestions here on StackOverflow to run this command: android update project --path . DO NOT DO THIS for JUCE. This re-writes your build.xml file and the special JUCE stuff to build the C++ code disappears; then you build and you get a tiny .APK file (about 10 KB) that contains only the Java setup code and no compiled C++, and does not work. So, just to be clear, the solution to the "setup" build problem is to delete that build task and touch nothing else, and not to completely replace your build.xml file.
The JUCE build process relies on a Bash shell script to do some work. On Mac OS X this works great; on Windows, the build fails with an error from CreateProcess() because CreateProcess() doesn't understand Bash shell scripts. It should be possible to edit this and make it work, but out of the box it works perfectly on Mac OS X.
For testing your code on an Android device, you must sign your code. Eclipse makes it easy to build either signed or unsigned .APK file, but the unsigned file is nearly useless. The only thing you can do with an unsigned .APK is run it in the emulator.
Once I had all the above stuff correct, I had no problems with building the JUCE app for Android.

Why we use build.xml in android?

I am android developer.I am not aware of ant in android .I have downloaded a code from internet But It has file called build.xml but I am not able to find out what it is doing and for what purpose it is used please give some advise or some kind of tutorial.So I can understand its working thanks in advance.
When you are developing your application, Eclipse is the most convenient way of building the project.
However Ant is most useful when you come to produce a release version. You can set up your Ant build, such that it takes the same source files as the Eclipse project, yet produces a signed, zip-aligned version of the apk in completely separate output location.
By means of a custom build.properties file you can specify source and output locations, keystore names and locations and passwords. It also takes care of any Proguard obfuscation you may want.You can do all this from the command line with a single statement and know that you are going through a repeatable process, not vulnerable to a mouse click in the wrong place.
Have a look at Managing Projects from the Command Line and Building and Running from the Command Line
Take the build.xml from the sample project referred to and use it as a basis for your own project. It works pretty much out of the box.
This build file is an alternative (and less common) way to build your projects using ant.
Eclipse (and the Android plugins) do a n excellent job of saving you the trouble - just use the plugin to build your projects and export APKs.

Ant versus Eclipse builds for Android: Strengths of Each?

I've used Eclipse and vim variously as development environments for Android applications and found both the Eclipse plugin and the command-line SDK tools to be of similar capability.
Since I haven't explored either in its entirety, however, I'd like to ask:
What advantages are there to using Eclipse over the command-line tools and vice-versa?
I could see:
(Eclipse) nice GUI for debugging
(ant/adb/android) more amenable to automation
(hybrid) you can have it all, can't you!?
I'm especially interested in specific features that may be a deal-breaker for one and move a developer in the direction of the other.
Using Eclipse as a development environment for Android doesn't preclude you from also building with Ant to hook into nightly builds or CI tools. You could even configure Eclipse to build using your Ant buildfile if you wanted. If you want some kind of CLI build tool, you might also consider Maven, as it also has plugins to enable building Android apps.
It has been some time (like six months) since I have used eclipse, so maybe it is better now, but I gave up on it because I found it to be very slow and buggy. Maybe it is the integration with ADT, but several times I spent hours hunting down problems that turned out to be fixed if I killed and restarted eclipse (and these problems were not fixed if I did a "clean" within eclipse). After doing that a few times, I felt like throwing the computer against the wall.
"ant clean" is much easier and faster than stopping and restarting eclipse.
Across my personal projects and multiple professional instances of building Android apps, I've always used both types of builds. You'll want to use Ant (or Maven, if you prefer) to set up continuous integration and automated testing. Trying to get that working with Eclipse (which I did a long time ago when the Android SDKs were first coming out) is a nightmare, while Ant/Maven is easily used from any of your favorite CI tools (I've usually used Hudson for this). If there's nothing unusual about your project, it'll be a snap to put together continuous integration, and off you go.
Meanwhile, for just day to day development work, using Eclipse to build your app locally works just fine. But that can easily be left up to the individual developer. I'd make the build that your CI system is running the canonical build, but I do use Eclipse for my normal development.
I'd use Eclipse until such time as you are happy with the debug build. Then you can set up Ant to produce the signed release build.
You can set it up to use the same source files as Eclipse but put the output binaries outside your workspace. You can also set it to use your release.keystore, sign it automatically and obfuscate the code all in one go.
I've set it up to do this. I open a command line (DOS box) move to the projects home directory (\dev\projects\Eclipse\Project1 say), I type "Ant release" and the apk ends up in \dev\projects\AntBuilds\Project1\bin as Project1-release.apk.
If you want the best of both worlds, you might want to look at the m2eclipse-android-integration Eclipse plug-in which allows you to use your command-line Maven build in the ADT/Eclipse environment as well:
https://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/
Well for me im just a beginner, but I find eclipse much easier to work with. Android is a pretty complicated to get used to (for me) so having everything layed out in a GUI is preferable to command line. Plus SDK updates and such are easier to get.

Categories

Resources