1. 在应用程序的 AndroidManifest.xml中的manifest节点中加入android:sharedUserId="android.uid.system"这个属性。

2. 修改Android.mk文件,加入LOCAL_CERTIFICATE := platform这一行
3. 使用mm命令来编译,生成的apk就有system权限了

将 工程目录拷贝到:

-

packages/apps/

进入添加Android.mk文件

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := Wifi_Test1
LOCAL_CERTIFICATE := platform

include $(BUILD_PACKAGE)

# Use the folloing include to make our test apk.

include $(call all-makefiles-under,$(LOCAL_PATH))

修改  AndroidManifest.xml

添加:

      package="com.wpstar.Wifi_Test1"
      Android:versionCode="1"
      Android:sharedUserId="android.uid.system"
      Android:versionName="1.0">
   


目录下运行  mm

则:

Copying: out/target/common/obj/APPS/Wifi_Test1_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Wifi_Test1_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Wifi_Test1_intermediates/classes.jar
Copying: out/target/common/obj/APPS/Wifi_Test1_intermediates/noproguard.classes.jar
target Dex: Wifi_Test1
Copying: out/target/common/obj/APPS/Wifi_Test1_intermediates/noproguard.classes.dex
target Package: Wifi_Test1 (out/target/product/generic/obj/APPS/Wifi_Test1_intermediates/package.apk)
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
 'out/target/common/obj/APPS/Wifi_Test1_intermediates//classes.dex' as 'classes.dex'...
Install: out/target/product/generic/system/app/Wifi_Test1.apk
安装成功..

运行后:

查看进程::

system    1618  1134  72084  16956 ffffffff afd0c51c S com.wpstar.Wifi_Test1


更多相关文章

  1. Android Studio中src/main/res/values中strings.xml文件中字符串
  2. Android之SDK、NDK、JNI和so文件
  3. android通过chmod命令实现文件权限修改
  4. Android心得3.2--用SAX解析器解析xml文件内容
  5. Android 用style简化layout布局文件
  6. 【android】下载大文件保持wifi网络连接
  7. android 布局文件中控件ID、name标签属性的命名包含“@”、“.”
  8. android 编译之后的文件系统和内核
  9. android:XML文件报错!Incorrect line ending: found carriage retu

随机推荐

  1. Android(安卓)Butterknife 框架源码解析(1
  2. 第二届 Android(安卓)应用开发中国大学生
  3. Android解析带转义符的JSON
  4. 使用webView访问https的url-处理SslError
  5. Android(安卓)如何设置RadioButton中图片
  6. 【Android】Animation之震动效果动画在登
  7. Android控件组合应用一
  8. 简单的Android(安卓)XML布局使用
  9. A007-assets资源
  10. Android(安卓)进阶——上传Java项目及And