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)
Related
How to know which Emulator image will contain su?
I can see that often it only contains su or google play
Run adb root and you get a root shell ... otherwise su needs to be manually installed.
However, when already having a root shell available, installing it isn't much of a problem.
All images are rooted, but SDK apps requesting escalation of privileges do rely upon su.
This question here generally duplicates: How to get root access on Android emulator?
adb shell scripting must:
start the emulator
run adb root
run adb shell
remount system partition
adb push the su binary
chmod to set permissions
exit
Or to answer the question:
start the emulator
and check if the file exists, eg. with adb shell stat /usr/bin/su
Where stat gives this response, when it's not installed:
stat: '/usr/bin/su': No such file or directory
One could even loop all Android images installed in $ANDROID_SDK_HOME...
there's no "one click" solution, but adb can be fully automated with Bash or Batch. And one wouldn't even have to run the emulator, but can mount QCOW2 as a nbd network block device.
Hello I have 2 Phones 1 it's work on it and the other not
am trying to make Android Package as system \
$ adb shell
$ mv /sdcard/base.apk /system/app/
$ cd /system/app/
$ chmod 644 base.apk
also tryed
$ adb shell am start com.****
didn't work
it's work fine
but in the other phone oppo 1201 Color os App never show app i tryed different launchers didn't work
can please some one told me why this dumb phone wont show apk as system or there system linker verify those applications !
Oppo runs Color OS which is heavily customised over android. It has a lot of restrictions compared to stock android, Oppo only has read access over its system partition. So you might need root access to move files into a system folder. Consider rooting your phone if you really want to do this.
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.
We've Android app 1.0 and make it in /system/app for the special ROM.
Now we have released upgrade version 1.1 of that app, after installation, the version is changed to 1.1 in App list in Android settings. But when I reboot the system, the updated version is missed, back in 1.0.
How resolve this problem? Any detailed introductions about it?
Thanks.
You can use this:
adb shell
su
mount -o remount, rw /system
cat ApplicationName.apk > /system/app/ApplicationName.apk
chmod 644 ApplicationName.apk
reboot
as far as I know pm install only updates user-applications.
If you are deploying the app from Eclipse or from another IDE (it is as far as I know the same thing as doing pm install) the app goes under data/app.
The app location now is /data/app/com.package.name-1.apk
After the deploying you can do
adb shell
su
mount -o remount, rw /system
cat /data/app/com.package.name-1.apk > /system/app/ApplicationName.apk
chmod 644 /system/app/ApplicationName.apk
reboot, for the changes to take effect
Cat is normally the same as copy or cp, but when you cat from the /data/app/ the original com.package.name-1.apk disappears (i guess android takes care of this automatically somehow)
You can test this by doing ls -al when under /data/app/ folder
Increase versionCode before you update your app.
In fact, the latest version of your app is installed into /data/app, when device reboot, the device will check whether the old app(v1.0) should be updated or not. However, according to scanPackageLI() in frameworks/base/services/java/com/android/server/PackageManagerService.java
if (ps != null && !ps.codePath.equals(scanFile)) {
// The path has changed from what was last scanned... check the
// version of the new path against what we have stored to determine
// what to do.
if (pkg.mVersionCode < ps.versionCode) {
// The system package has been updated and the code path does not match
// Ignore entry. Skip it.
......
} else {
......
}
......
}
You can find if versionCode is the same, old app will not update. So you need to increase versionCode in your app when you want to update old app.
PS: Replacing old app with new one using command line can meet your need but I really don't think it is good.
because the app is in System/app so,you should use push command
adb root
adb remount
adb shell rm /system/app/your.apk
adb push your.apk /system/app
to update it.
maybe you need delete it first.
Usually, if you push an app to system/app, and then install it into data/app, the app system/app only works after you reboot your device.
In case, you can check whether there is the app in data/app after you reboot your device.
adb shell ls /data/app
if you find it, you can delete it to make sure you don't have the same app:
adb shell rm /data/app/your-1.apk
Maybe you have install your application to /data/app not /system/app
try to move this app to /system/app
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.