APK 中的 Android APK?
正如我上面的问题所述,是否可以在另一个 apk 中包含一个 apk 文件? 为了进一步解释,这是我的情况:
我有两个应用程序,第一个应用程序通过意图调用另一个应用程序。我对此没有问题。但我需要的是仅安装一个 apk 文件而不是两个。我首先想到的是将 .apk 文件放入另一个 .apk 文件中。我真的不知道这是否可能,这就是为什么我需要你对此的看法。但如果这是不可能的,我希望有人能告诉我做这种事情的最佳实践是什么。
我可以将其作为一个应用程序,但这将是我的最后一个解决方案。
As stated in my question above, is it possible to have an apk file within another apk?
To further explain, here is my situation:
I have two apps and the first one calls the other through an intent.. I don't have problem with this.. But what I need is to install only one apk file instead of two. And the first thing that came into my mind is to put a .apk file inside the other .apk file.. I really don't know if this is possible that's why I need your take on this. But if this is not possible, I hope someone can tell me what would be the best practice to doing this kind of thing.
I can make it as one application, but that would be my last solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我现在刚刚这样做...
我将 apk 2 放入 raw/embeddedapk.apk
然后这段代码...启动了 apk 2 的安装程序... **如果用户手机不允许非市场应用程序,则会出现问题。它将无法安装 apk 2 ...
安装完成后记得删除临时文件...
我的原因是我希望 apk 1 用户界面和 apk 2 数据提供程序作为市场上的单独应用程序。但我不希望用户在第一次安装时单独关闭...
apk 1 需要来自 apk 2 的数据,apk 2 没有任何活动..
当用户从市场下载 apk 1 时,我想自动安装 apk 2 ...
我希望能够更新(市场)apk1 和apk 2 独立...
I just did that right now ...
I put apk 2 in raw/embeddedapk.apk
then this code ... started the installer for apk 2 ... **problem if user phone doesnt allow application not from market .. it will fail to install apk 2 ...
remember to delete temp file when the instalation is finished ....
My reason is I want to have apk 1 userinterface and apk 2 data provider as seperate apps in market. but i don't wnat users to down then individually when installing first time ...
apk 1 need data from apk 2, apk 2 does not have any activities ..
When user downloads apk 1 from market I want to auto instal apk 2 ...
I want to be able to update (market) apk1 & apk 2 independantly ...
也许 Android 库正是您所寻找的。您可以在此处放置一些通用代码并将其包含在多个应用程序 (apk) 中。
请参阅有关库项目的文档。
Perhaps an Android Library is what you are looking for. This is a place where you can put some common code and include it in multiple applications (apks).
See this documentation on library projects.
抱歉,如果您想在 APK 中添加 APK,那您就不走运了。
Android 不允许您这样做。
但我很好奇你为什么会想要这样?您可以从一项活动调用另一项活动,即使它们位于同一个 APK 中。
Sorry, you are out of luck if you want APK inside APK.
Android does not allow you to do so.
But I am curious about why you would want it that way ?? You can call one activity from the other even if they are in the same APK.
您可以将其编程为一个应用程序并具有两个启动器,以便它在用户看来是两个独立的应用程序。
您还可以尝试激发意图并发现没有人对此做出反应的情况。您也可以打开市场并建议安装该应用程序。
最后一种方法主要由需要文件浏览器来选择文件的应用程序完成。他们发送一个意图,如果没有安装文件浏览器,他们会提示一个 toast,通知需要文件浏览器来执行任务,然后他们打开 astro、OI 文件管理器或他们喜欢的其他应用程序的市场页面...
You can program it as one application and having two launcher so that it appears to the user as being two stand alone applications.
You could also try to fire the intent and catch the case that no one is reacting on it. Than you can open the market and recommend to install the application, too.
The last way is mostly done by applications that need file browsers to pick files. They send an intent and if there is no file browser installed, they prompting a toast informing that a file browser is needed to perform the task and they open the market page of astro, OI file manager or another app they prefer...