当我将android.permission.UPDATE_DEVICE_STATS添加到我的应用程序时发生错误 [英] when I add android.permission.UPDATE_DEVICE_STATS to my app.error occur

查看:318
本文介绍了当我将android.permission.UPDATE_DEVICE_STATS添加到我的应用程序时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个需要获得android.permission.UPDATE_DEVICE_STATS权限的应用.但是,当我将此权限添加到应用的AndroidMainfest.xml文件中时,会出现以下错误:

I developed an app which needs to get the android.permission.UPDATE_DEVICE_STATS permission. However, when I add this permission to my app's AndroidMainfest.xml file, I get this error:

权限仅授予系统应用程序"

"Permission is only granted to system apps"

我该怎么做才能将我的应用程序更改为系统应用程序?还有其他方法可以解决此问题吗?

What can I do to change my app to system app? Are there any other ways to solve this problem?

推荐答案

最重要的是要知道:系统应用程序只能由植根设备的人来运行.这意味着如果您没有root用户的设备,则无法测试和运行自己的应用程序.

Most importantly to know: A system app can only be run by people who have rooted their device. Meaning you can't test and run your own application if you don't have a rooted device.

您可以通过按如下所示在AndroidManifest.xml中设置sharedUserId来声明您的应用程序作为系统应用程序运行

You can declare your app to run as a system app by setting the sharedUserId as follows in the AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="[your package name]"
        android:sharedUserId="android.uid.system">

否则,您必须使用系统密钥对应用程序进行签名,请参见此线程如何在具有系统权限的情况下编译Android应用程序

Otherwise you have to sign your application with system key , see this thread How to compile Android Application with system permissions

这篇关于当我将android.permission.UPDATE_DEVICE_STATS添加到我的应用程序时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆