aapt:打包时不要跳过(空)文件
我正在开发一个 Android 应用程序,它使用 res/raw
中的许多 python 脚本,这些脚本通过 SL4A 部署并包含在应用程序的 APK 中。由于脚本使用 python 包,它们的目录包含许多 0 字节大小的 __init__.py
文件,Python 将这些目录识别为包所必需的。 我的问题是 aapt 在打包过程中跳过这些文件,从而阻止脚本在设备/模拟器上运行,因为解释器找不到模块:
[aapt] Creating full resource package...
[null] (skipping (null) file '/home/user/app/res/raw/pypackage/__init__.py')
有没有办法告诉 aapt 尽管如此,还是要包含这些文件,或者我是否必须手动填充文件以使它们的大小大于 0kb?我已经查看了 aapt 命令行选项,但没有找到任何内容。
I am developing an Android application that uses a number of python scripts in res/raw
that are deployed via SL4A and included in the app's APK. As the scripts make use of python packages, their directories contain a number of 0byte sized __init__.py
files that are necessary for python to recognize the directories as packages.
My problem is that aapt
skips those files during packaging, thus preventing the scripts from working on the device/emulator, as the modules are not found by the interpreter:
[aapt] Creating full resource package...
[null] (skipping (null) file '/home/user/app/res/raw/pypackage/__init__.py')
Is there a way to tell aapt
to include the files nevertheless, or do I have to pad the files manually to make them >0kb sized? I already looked at the aapt
command-line options but I didn't find anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是您唯一的问题,您只需在
__init__.py
文件中添加注释“#”即可。如果您发现目录结构有更多问题,您可以使用 tar 或 zip 并在 APK 安装后将其展开。
If this is your only problem you can just add a comment '#' inside the
__init__.py
files.If you find more problems as the directory structure you can use a tar or zip and expand it after APK installation.