Install app from Eclipse to /system/app at compile time - android

I'm installing my application in /system/app folder. But it very difficult every time use ADB for do it. Is there any way to install app at compile time from Eclipse to /system/app folder?
This commands I'm using for install. But I want avtomate this commands from Eclipse when I press Run button. How can I do it?
adb push C:\XXX.apk /sdcard/XXX.apk
adb shell
su
mount -t rfs -o remount,rw /dev/block/stl9 /system
busybox cp /sdcard/XXX.apk /system/app/XXX.apk

For development work, you can run "adb install" from a command line, or let Eclipse run the "adb install" for you automagically.
If you want to "publish" your .apk, you'd typically use Android Market.
Here are a few options that don't necessarily require Android Market:
http://maketecheasier.com/install-applications-without-the-market/2011/01/28

Related

adb install system app

I am aware that using adb install command installs an app in the /data/app folder. Also I know the in order to install an app as a system app I need to push it directly to the system. Is it possible to use adb install directly to the /system/priv-app/ on rooted phones?
if I got your question, this should do the work:
adb root
adb remount
adb push apk-filename-here /system/app/
adb shell chmod 644 /system/app/apk-filename-here
adb reboot
See this or this link for more info.
You can not use adb to directly install app at /system/priv-app/. Even If you copy your .apk, .odex files to this path device can not recognize your app as system app. For this you have to use same certificate with which your system apps are signed.

Android: Difference between User vs System App development [duplicate]

I need create my app as system, because i need get permission android.permission.WRITE_SECURE_SETTINGS.
After install to virtual device (Eclipse) my app appears in '/data/app'. I try manually move him to '/system/app', set rights 644, but when i launch my app - toast 'App isn't installed'. After reboot (close virtual device and restart) my app disappeared from '/system/app'.
Add:
- 1. Why android can not see my application in '/system/app'?
- 2. Why after restart virtual device my app disappeared from '/system/app'?
What the best way make my app system on Eclipse Emulator and real devices?
The apps installed on your Android devices can be broadly categorized as system apps or user apps, based on their installation location. The user apps are just all your normal app installations through the Google Play Store, Amazon Appstore or sideloading. These go into the /data partition of your Android phone, which is the part of the internal memory made available for user data and apps.
System apps are basically the apps that come pre-installed with your ROM. In a standard Android user environment, the user doesn’t have write access to the /system partition and thus, installing or uninstalling system apps directly isn’t possible. The process isn’t as hard as it may sound. However, there is a catch.
In order to install an app as a system app on your Android device, your device must either be rooted, or have a custom recovery installed (or both). Usually pretty much everyone who has a custom recovery installed uses a rooted ROM, so we’ll just be using the method for rooted phones.
Go to below tutorial.it might help you.
Make Your app System App
You cannot make your app by default as the system app. There are some other ways though through which you could make other normal apps as system apps on rooted phones.
You can install an APK to /system/app with following steps.
Push APK to SD card.
$ adb push SecureSetting.apk /sdcard/
Enter the console and get the shell
$ adb shell
Switch to superuser. If your device is not rooted, get it rooted first. (If you don't know how to do that, just Google.)
$ su
Remount the system partition with WRITE permission.
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Cat your APK from /sdcard/ to /system/ , some guys get a fail with cp command due to cp is not supported. So use cat instead.
$ cat /sdcard/SecureSetting.apk > /system/app/SecureSetting.apk
Remout /system partition back to READ-ONLY, and exit
$ mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
$ exit
Then reboot your device, the APK should have been installed on /system/app.
As stated here.
You can't make an application as system app on emulator.But you can make an app as system app on device.For that, you need to have the git repo set up on your pc,and after setting up repo, copy the app folder in repo folder/packages/apps and put it for compile.and you will get system.img in out folder of repo.Then you can flash the system.img on sd card, so that you will get your app as a system app.And this is the only way is there to make an app as system app.
If the device is not rooted, you cannot copy anything to the System or Data partitions.
With root do the following commands in a command prompt or linux shell and all should be fine:
adb push fileName /data/local/tmp
adb shell
su
mount -o remount, rw /system
cp /data/local/tmp/fileName /system/folderOfYourChoise
chmod 644 (if its an apk and you want the system to use it as a system app)
exit (exits the su shell)
exit (exits the adb shell)
adb reboot (to apply and see changes on the device)

Batch file to run an Android app in emulator

compile.bat:
set PATH=%PATH%;H:\Source\Program\sdk\tools;
set PATH=%PATH%;H:\Source\Program\sdk\platform-tools;
cd sdk\tools
emulator -avd emulator2
adb wait-for-device
cd sdk\platform-tools
adb install -r SP.apk
Here is my batch file to run a .apk into an emulator. It is from a CD, my adviser wants to run my app in his computer using my CD. My SDK folder is also in the CD and is the same directory with my compile.bat. Is my setting of path correct? Also there is an error when I test the compile.bat from the cd, it says too many files specified; only take APK file and verifier file.
The adb install command also become like this adb install -r SP.apk apk P.apk T_ROOTPROJECT_NAME-debug.apk. I only want to install SP.apk in the emulator.
When I run the commands in cmd, not in a batch file it is working.
Also I want to know how to enable the camera in my laptop to the emulator. My app requires the camera to run.
Can someone help me please? I am begging you. I need this tomorrow its for my graduation. Thank you.

Google Play on Android 4.0 emulator

How can I install the Google Play .apk onto my Android 4.0 emulator?
Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk , Phonesky.apk) from here.
Start your emulator:
emulator -avd VM_NAME_HERE -partition-size 500 -no-audio -no-boot-anim
Then use the following commands:
# Remount in rw mode.
# NOTE: more recent system.img files are ext4, not yaffs2
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
# Allow writing to app directory on system partition
adb shell chmod 777 /system/app
# Install following apk
adb push GoogleLoginService.apk /system/app/.
adb push GoogleServicesFramework.apk /system/app/.
adb push Phonesky.apk /system/app/. # Vending.apk in older versions
adb shell rm /system/app/SdkSetup*
For future visitors.
As of now Android 4.2.2 platform includes Google Play services. Just use an emulator running Jelly Bean. Details can be found here:
Setup Google Play Services SDK
EDIT:
Another option is to use Genymotion (runs way faster)
EDIT 2:
As #gdw2 commented: "setting up the Google Play Services SDK does not install a working Google Play app -- it just enables certain services provided by the SDK"
After version 2.0 Genymotion does not come with Play Services by default, but it can be easily installed manually. Just download the right version from here and drag and drop into the virtual device (emulador).
I do this in a more permanent way - instead of installing the APKs each time with adb, permanently add them to the system image that the emulator uses. You will need Yaffey on Windows, or a similar utility on other systems, to modify YAFFS2 images. Copy GoogleLoginService.apk, GoogleServicesFramework.apk, and Phonesky.apk (or Vending.apk in older versions of Android) to the /system/app folder of the system.img file of the emulator. Afterwards I can start the emulator normally, without messing with adb, and Play Store is always there.
Obtaining the Google Play app from your device
Downloading Google Apps from some Internet site may not be quite legal, but if you have a phone or tablet with a corresponding Android version, just pull them out of your device:
adb -d root
adb -d pull /system/app/GoogleLoginService.apk
adb -d pull /system/app/GoogleServicesFramework.apk
adb -d pull /system/app/Phonesky.apk
You must have root-level access (run adb root) to the device in order to pull these files from it.
Adding it to the image
Now start yaffey on Windows or a similar utility on Linux or Mac, and open system.img for the emulator image you want to modify. I modify most often the one in [...]\android-sdk\system-images\android-17\x86.
Rename the original system.img to system-original.img. Under yaffey, copy the APK files you pulled from your device to /app folder. Save your modified image as system.img in the original folder. Then start your emulator (in my case it would be Android 4.2 emulator with Intel Atom processor running under Intel HAX, super-fast on Windows machines) and you'll have Play Store there. I did not find it necessary to delete SdkSetup.apk and SdkSetup.odex - the Play Store and other services still work fine for me with these files present.
When finished with your testing, to alleviate your conscience guilty of temporarily pirating the Google Apps from your device, you may delete the modified system.img and restore the original from system-original.img.
Download the gapps package from http://goo.im/gapps
extract GoogleLoginService.apk,GoogleServicesFramework.apk and Vending.apk
Go to cmd window type
adb shell
on the shell type mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
then press Ctrl+c to exit.
cd to the directory where apks has been extracted,
type adb push <appname>.apk /system/app
then type adb reboot
It is simple for me i downloaded the apk file in my computer and drag that file to emulator it install the google play for me
Hope it help some one
You could download it from a Android 4.0 phone and then mount the system image rw and copy it over.
Didnt tried it before but it should work.
Playstore + Google Play Services In Linux(Ubuntu 14.04)
Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk )
from here http://www.securitylearn.net/2013/08/31/google-play-store-on-android-emulator/
and Download ( Phonesky.apk)
from here https://basketbuild.com/filedl/devs?dev=dankoman&dl=dankoman/Phonesky.apk
GO TO ANDROID SDK LOCATION>>
cd -Android SDK's tools Location-
TO RUN EMULATOR>>
Android/Sdk/tools$ ./emulator64-x86 -avd Kitkat -partition-size 566 -no-audio -no-boot-anim
SET PERMISSIONS>>
cd Android/Sdk/platform-tools
platform-tools$ adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
platform-tools$ adb shell chmod 777 /system/app
platform-tools$ adb push /home/nazmul/Downloads/GoogleLoginService.apk /system/app/.
PUSH PLAY APKS >>
platform-tools$ adb push /home/nazmul/Downloads/GoogleServicesFramework.apk /system/app/.
platform-tools$ adb push /home/nazmul/Downloads/Phonesky.apk /system/app/.
platform-tools$ adb shell rm /system/app/SdkSetup*
Have you ever tried Genymotion? I've read about it last week and it is great. They have several Android Images that you run (with their own software). The images are INCREDIBLY fast and they have Google Play installed on them. Check it out if it is the kind of thing that you need.
http://www.genymotion.com/

Pre installing android application

How to pre-install an Android application?
Because I have a specific device, and I wanted to make my application pre-installed.
I'm assuming you're talking about a rom here.
If you want the user to be able to delete the application you should put the .apk file in "/data/app"
If you want to have the app behave like a system app (like e-mail or calendar) you can put the .apk in "/system/app"
First we need all the pre-requisites needed.
We need to root our device to have super user capability, In my case I root my nexus one
Im not responsible if your device brick so be careful.
(http://forum.xda-developers.com/showthread.php?t=611829)
install superuser
(http://www.appbrain.com/app/superuser/com.noshufou.android.su)
Install BusyBox (to do shell command "cp") -- available in android market
(http://www.appbrain.com/app/busybox/stericson.busybox)
Execute the following commands in the terminal emulator to remount the /system directory as read/write and to install the application into the /system/app directory (http://www.nexusforum.net/nexus-one-application-day/524-nexus-one-app-day-2-8-10-powermanager.html):
adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cp /sdcard/sample.apk /system/app
Thanks for all those who helped me.

Categories

Resources