我如何注册我与系统签名密钥的应用? [英] How can I sign my application with the system signature key?
问题描述
我需要创建一个将使用应用程序的设置来开启/关闭WiFi的菜单设置 - >无线和一个Robotium申请;网络 - >无线网络连接。我设法找到一些示例code 这里演示如何通过具有唯一的apk文件启动应用程序。问题是,我Robotium应用程序应具有相同的签名与(系统)设置应用程序。当试图运行的应用程序我得到的错误信息:
试运行失败:权限被拒绝: 启动仪器 ComponentInfo {com.jayway.test / android.test.InstrumentationTestRunner} 从PID = 354,UID = 354不准 因为包com.jayway.test做 没有匹配的签名 目标com.android.settings
- 我可以以某种方式使之与Android模拟器? 工作
- 如果我编译Android手机的形象,我该如何使用Android系统的签名与我的应用程序?
我有同样的问题。有,只有系统的应用程序被允许有一定的权限。我试图访问
亚行外壳dumpsys
命令,从我与权限的应用程序 android.permission.DUMP
。
的解决方案,这是...
在项目的Android清单文件中添加以下行清单标签
安卓sharedUserId =android.uid.system
您需要有两个签名密钥present在用于构建二进制的code。
platform.x509.pem
platform.pk8
这是present在
安卓/编译/目标/产品/安全
从网上下载一个工具,即
signapk.jar
从Eclipse导出签名的apk。通过右键单击从Android工具项目。 保留所有的事情,即键,未签名的apk文件,并signapk.jar一个文件夹中。运行以下命令
Java的罐子signapk.jar platform.x509.pem platform.pk8 unsigned.apk signed.apk
未签名的apk是你的apk的名字,并签署APK是你想要的新名称。 在此之后仅仅用命令来安装在手机中的应用程序签署
亚行外壳安装signed.apk
I need to create a Robotium application that would use Settings application to turn ON/OFF WIFi from menu Settings->Wireless & networks->Wi-Fi. I managed to find some sample code here that demonstrates how to launch application by having apk file only. The problem is that my Robotium application should have the same signature with the (system) Settings application. While trying to run application I get the error message:
Test run failed: Permission Denial: starting instrumentation ComponentInfo{com.jayway.test/android.test.InstrumentationTestRunner} from pid=354, uid=354 not allowed because package com.jayway.test does not have a signature matching the target com.android.settings
- Can I somehow make it work with the Android Emulator?
- If I compile an Android phone image, how can I use the Android system signature with my application?
I was having the same problem.. There are some permissions that only system apps are allowed to have . I was trying to access the
adb shell dumpsys
commands from my application with the permissions android.permission.DUMP
.
The solution to this is ...
In the Android manifest file of your project add the following line in the manifest tag
android:sharedUserId="android.uid.system"
You need to have two signature keys present in the code that is used to build the binary.
platform.x509.pem
platform.pk8
that is present in the
android/build/target/product/security
Download a tool from the net i.e.
signapk.jar
From the eclipse export your unsigned apk. by right click on the project from the android tools. Keep all the things i.e. keys , unsigned apk, and signapk.jar in a folder. Run the following Command
java -jar signapk.jar platform.x509.pem platform.pk8 unsigned.apk signed.apk
unsigned apk is the name of your apk and signed apk is the new name you want . After this just install your signed app in the phone with the command
adb shell install signed.apk
这篇关于我如何注册我与系统签名密钥的应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!