java 如何制作我的应用系统
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14256687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make my application system
提问by Tapa Save
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'
.
我需要将我的应用程序创建为系统,因为我需要获得许可android.permission.WRITE_SECURE_SETTINGS
。安装到虚拟设备 (Eclipse) 后,我的应用程序出现在'/data/app'
. 我尝试手动将他移动到'/system/app'
,设置权限644
,但是当我启动我的应用程序时 - 吐司'App isn't installed'
。重新启动(关闭虚拟设备并重新启动)后,我的应用程序从'/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'
?
添加:- 1. 为什么android 看不到我的应用程序'/system/app'
?- 2. 为什么重启虚拟设备后我的应用程序消失了'/system/app'
?
What the best way make my app system on Eclipse Emulator and real devices?
在 Eclipse Emulator 和真实设备上制作我的应用程序系统的最佳方法是什么?
回答by Nirav Tukadiya
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.
根据安装位置,Android 设备上安装的应用程序可以大致分为系统应用程序或用户应用程序。用户应用程序只是您通过 Google Play 商店、亚马逊应用商店或旁加载安装的所有常规应用程序。这些进入 Android 手机的 /data 分区,这是可供用户数据和应用程序使用的内部存储器的一部分。
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.
系统应用程序基本上是随 ROM 预装的应用程序。在标准的 Android 用户环境中,用户没有对 /system 分区的写访问权限,因此无法直接安装或卸载系统应用程序。这个过程并不像听起来那么难。但是,有一个问题。
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.
为了在您的 Android 设备上将应用程序安装为系统应用程序,您的设备必须获得 root 权限,或者安装了自定义恢复(或两者)。通常几乎每个安装了自定义恢复的人都使用 root 的 ROM,所以我们将只使用 root 手机的方法。转到下面的教程。它可能对您有所帮助。
回答by Antrromet
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
.
默认情况下,您不能将您的应用程序设为系统应用程序。还有一些其他方法可以让其他普通应用程序作为系统应用程序在rooted phones
.
You can install an APK to /system/app with following steps.
您可以通过以下步骤将 APK 安装到 /system/app。
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
将 APK 推送到 SD 卡。
$ adb push SecureSetting.apk /sdcard/
进入控制台,获取shell
$ adb shell
切换到超级用户。如果您的设备未植根,请先将其植根。(如果你不知道怎么做,就谷歌一下。)
$ su
重新挂载具有 WRITE 权限的系统分区。
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
将您的 APK 从 /sdcard/ 转移到 /system/ ,由于不支持 cp,有些人使用 cp 命令失败。所以改用 cat 。
$ cat /sdcard/SecureSetting.apk > /system/app/SecureSetting.apk
将 /system 分区重新设置为 READ-ONLY,然后退出
$ 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.
然后重启你的设备,APK应该已经安装在/system/app上。如前所述这里。
回答by indraja machani
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/appsand 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.
您不能在模拟器上将应用程序制作为系统应用程序。但您可以将应用程序制作为设备上的系统应用程序。为此,您需要在您的电脑上设置git repo,设置好repo后,复制应用程序repo文件夹/packages/apps中的文件夹并把它编译。你会在repo的out文件夹中得到system.img。然后你可以在sd卡上刷system.img,这样你就可以将你的应用程序作为系统应用程序.这是将应用程序制作为系统应用程序的唯一方法。
回答by omor
If the device is not rooted, you cannot copy anything to the System or Data partitions.
如果设备没有root,则无法将任何内容复制到系统或数据分区。
With root do the following commands in a command prompt or linux shell and all should be fine:
使用 root 在命令提示符或 linux shell 中执行以下命令,一切都应该没问题:
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)