简体   繁体   English

将AndroidManifest.xml转换为Binary

[英]Convert AndroidManifest.xml to Binary

I have an AndroidManifest.xml, and I need to convert it to binary and place it by hand in the APK. 我有一个AndroidManifest.xml,我需要将其转换为二进制文件并将其手动放入APK中。 After that, I can do a manual sign and align. 在那之后,我可以做一个手动标志并对齐。

Longer explanation: I'm having trouble [again] with the familiar tools used in APK re-engineering, and I'm bulding the APK by hand with tools that don't crash. 更长的解释:我再次使用APK重新设计中使用的熟悉工具遇到了麻烦,而且我正在使用不会崩溃的工具手动建立APK。

Android includes sdklib.jar , but I'm having trouble calling it (and it might not perform 'just' the XML -> binary conversion). Android包含sdklib.jar ,但我无法调用它(它可能不会执行'只是'XML - >二进制转换)。

How does one convert AndroidManifest.xml to binary? 如何将AndroidManifest.xml转换为二进制?

You can try to run aapt manually like this: 您可以尝试像这样手动运行aapt:

$LIBS"aapt" package -f -m -F output_unsigned.apk --auto-add-overlay -S main/res -J Temp/gen -G Temp/android-aapt.pro -A Temp/assets -M Temp/AndroidManifest.xml -I $LIBS"android.jar"

In my case (under linux): 在我的情况下(在Linux下):

  • $LIBS"aapt" is a path to aapt file $ LIBS“aapt”是aapt文件的路径
  • output_unsigned.apk is where to save created APK output_unsigned.apk是保存创建的APK的地方
  • android-aapt.pro is where to save configuration for proguard android-aapt.pro是保存proguard配置的地方
  • Temp/gen, Temp/assets are my Android project folders Temp / gen,Temp / assets是我的Android项目文件夹
  • Temp/AndroidManifest.xml is desired manifest Temp / AndroidManifest.xml是所需的清单
  • $LIBS"android.jar" is JAR library for requested Android API level $ LIBS“android.jar”是请求的Android API级别的JAR库

It may not work for you out-of-the-box, but I hope it helps you to start with it. 它可能不适合您开箱即用,但我希望它可以帮助您从头开始。 Consult aapt help for more details. 有关详细信息,请参阅aapt帮助。

If you have not seen it yet, there is android-apktool , which is quite helpful for these kinds of things. 如果你还没有看到它,有android-apktool ,这对这些事情非常有帮助。 I have successfully used them before in repacking APKs by hand after modifying their binaries. 我在修改二进制文件后手动重新打包APK之前已经成功使用过它们。

You can also look for the apkbuilder tool which is in my android-sdk-linux/tools/ directory. 您还可以在我的android-sdk-linux/tools/目录中查找apkbuilder工具。 (It is, however, deprecated.) (但是,它被弃用了。)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM