How to create batch command for : compile + sign + install + run - android

Background
As it turns out, it's quite an annoyance to test out in-app-billing (i've written about it here) . Each time you find a bug and need to test your app, you must have the following steps:
compile the app , preferably with the debuggable="true" flag on the manifest
sign the app with your real key you've created for the play store.
install the app on your device
run the app on your device, preferably debugging it via eclipse.
If you'd use a batch operation instead of doing all of those by yourself, it should make things easier to test such apps, and might also be useful for other apps as well.
The question
Is there any way to make the whole process fully automatic, so that with a single click of a button, it will do all of the above?
I know how to achieve 3+4 (using "adb.exe install -r *.apk" and "adb.exe shell am start -n FULL_ACTIVITY_PATH" ), but I don't know how to achieve the others.
If there is a solution that doesn't involve a third party app or plugin (like maven or Ant), it could be very nice. Of course, if that's what is available, I would like to know if it's possible to achieve via a batch file that will use them somehow.
Is there maybe a way to mimic how Eclipse does things in this regard, without being so specific on the project (maybe just the path of the project and that's it)?

Maybe you can package app by ant . You can do every thing you what int the ant code of packaging ,causing the core code is to make property configs in your app and referenced lib, such as build.xml,local.properties...,and replace channel in AndroidMainfest.xml ,so you can also replace any code in your android app,just as you want ,to change the flag of debug , because all the operation just handle local file before packaging your app,you can copy or modify any file in your app. After above process ,you get a app,then you can run other code to install the app. Recently ,I have been using the batch package method to get a lot of app for different channel .so hope it helps.

Related

How to create a system app for custom ROM

We have a custom ROM for a device we are making and what I want to do is make our own custom Settings app to replace the settings app that comes already built in android.
I cant really find any documentation on how to even create a system app. It does not appear you can create it in Android Studio, I tried looking on the AOSP site and didnt find anything there related to creating system apps. The few things I did find were on here where you would put android:sharedUserId="android.uid.system" in your manifest and then has to be signed with the same key as the ROM but after that I cant find anything.
The settings app I want to create would need access to the framework.jar to be able to use the hidden framework API's.
Does anyone have any information or know where I can find this information on how to go about actually creating a system app?
You may want to research how to make a Device Tree Overlay (dto). Basically it is your code, reformatting the base code, into what you want. https://source.android.com/devices/architecture/dto?hl=en
Since you said you use Gradle, you should put first build you apk and put them in you vender folder, and next important thing is to create a mk/bp file to tell the Android build system how to deal with this pre-built apk.
P.S. If you system app highly depends on Android hidden api, make sure you have the right version of framework.jar in you Android Studio project, or, as what I alway did, create apps directly in AOSP, in this case, you can just check the code structure of the original Settings app in AOSP
this tutorial may help you.

how to issue an adb command from built in eclipse UI in Android SDK

Is there way in which I can run an adb command from inbuilt eclipse UI in Android SDK?
I need to find out if ECLIPSE UI already has this functionality, if not need to go about implementing it.
Till now I have been mainly using adb commands on command line.
If there is no such functionality would implementing a Eclipse plug-in would be the best way to handle this?
I want this as a feature, so I have already ruled out the use of "External tools Configuration" which needs to be configured individually for every project an end user builts.
EDIT:
I don't need another console, may it be inside eclipse or outside. What I want to write is a UI which works according to my specific need but abstracts away the command line details from the end user. Now I can still explore on how to do that, but I was looking for an existing example which does this for its specific need,through its UI and abstracts away the details of command line for its own sake.
Well, you could install a shell plugin, to give you access from within Eclipse, perhaps http://marketplace.eclipse.org/content/easyshell
Or even better, you can execute some Shell commands directly from the console. Looks like this SO question addresses exactly how to do that (and best of all, it is built in already).
Is there an Eclipse plugin to run system shell in the Console?
This would allow you to execute any adb commands, as you would essentially be escaping to the shell anyway.

How could you generate an APK from project B programmatically, using a button click from project A?

I have a project A that should use a wizard to create a project B. Project B is based on a template. Project A should send data to that template and generate an APK from this data and template programmatically.
I've read about the APK structure and what it includes, like classes, resources, and manifest files. My question is, what is the best way to achieve this template-based generation of an APK? What could I use for this?
This is the open source project you're looking for.
https://code.google.com/p/terminal-ide/
Terminal IDE is a command line java / android dev kit that runs on the device itself. Using a correctly configured vim, bash and busybox, in a custom terminal + custom keyboard environment. All these applications are put together so that they interact correctly. A full Terminal emulator + custom ANSI keyboard ensure good bash, vim and busybox emulation. All set up and ready to run in a NON-ROOT environment. Normal user permissions are enough to run all of this.
You can also download it from Google Play here. The application has 4.7 stars on the Play Store from 1,324 ratings. Here is one of the latest written 5 stars reviews this application received on Google Play. And it's not unique by any means (the emphasis in bold is mine).
A Google User - March 12, 2013 - Version 2.02
Wow!
I have over 30 years programming experience (mostly in C/C++ and Assembly) and have been looking to learn to program Android. I looked everywhere for a way to compile and run Java tutorials on my tablet, with no success, until I found Terminal IDE! Then I started playing around with its capabilities and let me say again, wow. DEVELOPER - I have only one suggestion, which others have brought up too: reduce the internal memory footprint. Maybe breakup the different languages into installable add-ons?
In a way, it's a lot like the Android Java IDE called AIDE, minus the GUI interface (but unlike AIDE, it's doesn't have low artificial file limits, and since it's open source it can actually be used to build your own project upon and extend).

Launch .apk file on Android device

Might seem a pleonasm the 'Title' but I wrote it to emphasize the issue.
I have an application running on an Android device, using the 2.2 Froyo library. The application has to (1) install - if not already installed - then (2) launch an .apk file already present in the data/data/myapp/files/ folder.
Knowing Java I would have used a shell execution of the above operations. But Android is also a separate namespace, therefore I would like to know how to do the sequence install + launch of the .apk file.
To note that, while I'm using Eclipse/Ubuntu now, the implementation should take into account ONLY the Android OS APIs, not my dev environment available tools.
Thanks
You do not launch an apk file. An apk file can be thought of as a container holding some number of activities, services, receivers, among other constructs. It's likely you mean you want to launch an activity (which is performed using the startActivity() method from the Context class, or one of its many subclasses) but by no means is that a certainty.
It would seem from your question that you need to learn quite a bit about Android before continuing on the path suggested by your question, because the question you've posted is really too vague to be answered in a reasonable manner for stackoverflow.

Can we change Android source code using Android NDK..?

I am having a requirement like to add a custom setting to android native settings(like when we go to Home->settings->Display we have Screen timeout,Animation,Auto-rotate screen,Brightness settings available.But i want to add one more setting like auto-screentimeout there.i,e i need to change the source code of android..some thing related to forked android consept)so,Is this possible..?if so can we use NDK for this...
Thanks in advance...
You can download the Android source code and then create your own settings APK. However it will probably only run on the phone you are testing it, and I assume you run into problems when using different Android versions or some modifications by device manufacturers.
Read more http://source.android.com/ on how to get started.
Alternatively you could extract the settings APK from your current phone, decompile it with apktools, and then re-create it again with your changes.
Read more on http://code.google.com/p/android-apktool/
In both ways you need to have root access to install the new APK... and probably a custom recovery to restore from a nandroid backup when your modification crashes!
The Android NDK is for writing application code in C or C++.
What you want is to build your own version of the Android firmware; it is a completely separate issue. Have a look at this for starters.

Categories

Resources