简体   繁体   English

如何在 Windows 上将我的 apk 构建为系统应用程序?

[英]How do I build my apk as a system app on Windows?

I have seen many guides online for how to do this, but they are all assuming a linux environment.我在网上看到了很多关于如何做到这一点的指南,但它们都假设是 linux 环境。 I am developing using Android Studio on Windows, and am having trouble following these guides.我正在 Windows 上使用 Android Studio 进行开发,并且在遵循这些指南时遇到了麻烦。 Specifically, I do not know where to find the platform.pk8 and platform.x509.pem files required for making my keys.具体来说,我不知道在哪里可以找到制作密钥所需的platform.pk8platform.x509.pem文件。 The guides all say they are located in build/target/product/security , but I assume this is the corresponding linux directory.指南都说它们位于build/target/product/security ,但我认为这是相应的 linux 目录。 Where can I find these files on my windows device?在我的 windows 设备上的哪里可以找到这些文件?

To have a system app in Android OS you need to sign your APK by the same key which the OS is signed.要在 Android 操作系统中拥有系统应用程序,您需要使用与操作系统签名相同的密钥对 APK 进行签名。 These key in the Android open source project can find in Android开源项目中的这些key可以在

build/target/product/security构建/目标/产品/安全

But each company has got its own key and you cannot access to those key.但是每个公司都有自己的密钥,您无法访问这些密钥。 You can build your own Android image and load it your own development bard which probably is not easy.您可以构建自己的 Android 映像并将其加载到您自己的开发人员中,这可能并不容易。 Then you have a system key.然后你有一个系统密钥。 you can find useful information here你可以在这里找到有用的信息

But the main reason if being a system app is to have the privileges of a system app.但是,如果是系统应用程序,主要原因是拥有系统应用程序的权限。 What are those privileges?这些特权是什么? granting all permission and have access to the restricted area and secure setting for example.例如,授予所有权限并可以访问受限区域和安全设置。

So there is another possible way to be a system app.因此,还有另一种可能的方式成为系统应用程序。 If you can push(copy) your APK to /system/priv-app/ folder, then Android will grant all system privileges to your app automatically.如果您可以将您的 APK 推送(复制)到/system/priv-app/文件夹,那么 Android 将自动为您的应用授予所有系统权限。 (to all application in /system/priv-app/ folder not just to your app). (对于/system/priv-app/文件夹中的所有应用程序,而不仅仅是您的应用程序)。

How you can push your file into /system/priv-app/ ?如何将文件推送到/system/priv-app/

When you have Android Studio probably you can run adb.当您拥有 Android Studio 时,您可能可以运行 adb。 you can find some information here You can connect to your android device using adb and through your local network您可以在此处找到一些信息您可以使用 adb 并通过您的本地网络连接到您的 android 设备

adb connect deviceip:port亚行连接设备IP:端口

port by default is 5555 and you don't have normal type it.默认情况下端口是 5555 并且您没有正常输入它。 For connecting to an Android device the device should in developer option.要连接到 Android 设备,该设备应在开发人员选项中。 you can find some useful information here你可以在这里找到一些有用的信息

when you connected to your device you check if your device is rooted and the system folder is mountable or not.当您连接到您的设备时,您会检查您的设备是否已植根并且系统文件夹是否可挂载。 /System/ folder is protected by AVB and furthermore, you need to be a root user, so you use the following command /System/ 文件夹受AVB保护,此外,您需要是 root 用户,所以您使用以下命令

adb root亚行根

adb remount adb 重新挂载

if your device is rooted you can easily push your APK to system folder and have all privileges of a system app.如果您的设备已植根,您可以轻松地将您的 APK 推送到系统文件夹并拥有系统应用程序的所有权限。

adb push <yourPackagePath> /system/priv-app/ youtPackage/yourPackage.apk adb push <yourPackagePath> /system/priv-app/youtPackage/yourPackage.apk

if your device is not rooted you should search for how you can root your device如果您的设备未植根,您应该搜索如何植根您的设备

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在应用程序中内置图像 - How do I build in images to my app 如何在我的应用程序中共享 apk 文件(共享同一应用程序的 apk 文件) - How can i share apk file in my app (Share the apk file of the same app) 如何避免在我的应用中将APK反编译为Java文件 - How can I avoid the decompile APK to Java file in my app 如何在Windows构建计算机上为Max OS X创建Java .app捆绑包 - How can I create a Java .app bundle for Max OS X on my windows build machine 如何在我的 android 应用程序中根据请求自动授予 SYSTEM_ALERT_WINDOW 权限? - How do I grant SYSTEM_ALERT_WINDOW permission automatically on request, in my android App? 如何在 Android 中构建 APK? - How can I build an APK in Android? 在开发者控制台中激活更新的apk时,我需要重新发布我的应用程序吗? - When activating an updated apk in dev console do i need to republish my app? 如何通过gradle构建变体生成的两个版本的GPS应用的图标不同? - How do I get different icons for the two versions of my GPS app generated via gradle build variants? 我的 android studio 项目没有给我构建 apk 的选项。 我该如何解决? - My android studio project is not giving me the option to build apk. How can I fix it? 我想在Mac OS / Windows上的System Startup上运行我的Java程序。我怎样才能做到这一点? - I would like to run my Java program on System Startup on Mac OS/Windows. How can I do this?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM