有没有一种简单的方法可以让 Android APK 具有外部属性?
我有一个通过桌面计算机上的 ADB 调用的 Android 应用程序。我的桌面计算机上有一个属性文件,Android 应用程序需要以某种方式了解该文件,但它们需要位于 APK 外部。
在桌面上(将通过 ADB 调用 APK 内的活动)我无法轻松地使用 .properties 文件重新打包 APK,然后在手机上重新安装 APK(我通过 aapt 尝试过此操作,但并不可取,因为它删除 APK 上的签名,我无法轻松地在特定台式机上放弃该 apk)。
我宁愿不通过意图附加传递它们,因为它们有很多,而且我不能使用 adb shell setprop 因为它在手机运行时不起作用。我也不能将它们放在外部存储上,因为我不能保证手机有 SD 卡。我可以将它们放在“内部存储”的某个地方(如果存在)吗?
当我安装 APK 时,我基本上需要能够将大量属性传递到设备上,但我无法将它们放入 APK 本身,而且并非所有设备都会有 SD 卡。
有什么想法吗?
I have an android application that gets invoked through ADB on a desktop machine. I have a properties file on the desktop machine which the android application somehow needs to be aware of, but they need to be external to the APK.
On the desktop (which will invoke the activities within the APK via ADB) I cannot easily repackage the APK with the .properties file and then re-install the APK on the phone (I tried this via aapt, but it is not preferable because it removes the signature on the APK and I cannot easily resign the apk on the particular desktop machine).
I would rather not pass them via intent extras, as there are a lot of them, and I cannot use adb shell setprop because it doesn't work while the phone is running. I also cannot put them on external storage because I am not guaranteed the phone will have an SD card. Can I put them in "internal storage" somewhere (if that exists) ?
I basically need to be able to pass numerous properties onto the device when I install the APK, but I cannot put them in the APK itself, and not all the devices will have SD cards.
Any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这里使用的方法:android :以编程方式通过 USB 将 sqlite 数据库从 PC 传输到设备
Take a look at the method used here: android: transfer sqlite database from pc to device via usb programatically