构建一个Android APK具有相同的证书系统 [英] Building an Android APK with same certificate as the system

查看:281
本文介绍了构建一个Android APK具有相同的证书系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使系统应用程序的工作。这是我有:

I'm trying to make a system app work. Here's what I have:

这是OEM OMAP平台,以饱满的4.4.2源$ C ​​$ C。我已经建立了系统,并使用Ubuntu 14.04我的平台上加载。这所有的作品。

An OEM OMAP platform with full 4.4.2 source code. I've built the system and loaded on my platform using Ubuntu 14.04. That all works.

现在,存在从其中直接访问硬件的OEM(DSP,I2C,UART)等等随附从OEM最初APK工作我的平台上。一个应用

Now, there is an app from the OEM which directly accesses the hardware (DSP, I2C, UART) etc. The original APK that came from the OEM works on my platform.

我建立使用命令(不使用Eclipse)完全相同的应用程序;它建立我可以在平台上进行安装。但是,当我尝试启动应用程序时,它会停留在一个永恒的等待状态。

I built the exact same app using make command (not using Eclipse); It builds and I can install on the platform. But when I try to launch the app, it gets stuck in an eternal wait state.

我不知道,但我怀疑我的本地制造的应用程序尝试初始化电路板上的硬件组件,然后被阻塞在那里。

I am not sure, but I suspect my locally built app tries to initialize a hardware component on the board and then gets blocked there.

我一直在阅读文章全部结束,并且好像它是与应用程序签名和证书。我认为,总的想法是应用程序需要与系统本身同一证书进行签名。我想,既然我建这两个应用程序和系统使用相同的命令在同一台机器上,他们将有一个相同的证书。

I've been reading articles all over, and seems like it has something to do with the app signing and certificate. I think the general idea is the app needs to be signed with the same certificate with the system itself. I thought, since I built both the app and the system on the same machine using same commands, they would have a same certificate.

如果有帮助,清单文件中有这样一行:

If it helps, the manifest file has this line:

android:sharedUserId="android.uid.system"

和项目进行文件 Android.mk 有这样一行:

And the project make file Android.mk has this line:

LOCAL_CERTIFICATE := platform

谁能告诉我怎样才能使应用程序的工作?我不知道,好像我必须重建适当证书的应用程序,以便它可以访问所有的硬件​​资源。

Can anyone show me how can I make the app work? I am not sure, seems like I have to rebuild the app with proper certificates so that it can access all the hardware resources.

感谢。

推荐答案

检查<一href="http://stackoverflow.com/questions/3635101/how-to-sign-android-app-with-system-signature">signing系统APK 。

(可选):

您需要创建一个密钥存储文件通过使用密钥工具 - importkeypair,你可以找到这里

You need to create a keystore file by using keytool-importkeypair which you can find here.

走进了:编译/目标/产品/安全/ 目录在你的平台源代码树(来源$ C ​​$ CS关系到你的Andr​​oid版本和供应商)。

Go into the: build/target/product/security/ directory in your platform source tree (source codes related to your Android version and vendor).

您将发现的 platform.pk8 platform.x509.pem 文件。

You will find platform.pk8 and platform.x509.pem files.

通过这个例子命令创建密钥存储文件:

Create keystore file by using this example command:

keytool-importkeypair -k ~/.android/debug.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform

您可以使用该密钥库文件签署您的apk将具有系统权限之后。

You can use this keystore file to sign your apk which will have system permissions afterwards.

这篇关于构建一个Android APK具有相同的证书系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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