将两个APK成一个APK? [英] Bundle two apk into a single apk?

查看:450
本文介绍了将两个APK成一个APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个已完成的项目,一个用于展示的图书列表,另一个是浏览器应用程序来阅读的书籍。但是,随着用户必须下载图书清单应用程序,并在下载完成后,他已经下载的查看器应用程序,我希望把它下载并安装在起跑线。当我尝试包括图书清单应用程序,然后两个都安装了浏览器的应用程序,但是当我做了apk文件,然后使用仅安装了图书列表应用程序的apk文件。谁能告诉我是什么问题?而且是有什么办法可以将两个APK成一个?或者我应该怎么办?

I have two completed projects, one for showing list of books and another is viewer app to read the books. But as the user have to download the book list app and after downloading he has to download the viewer app and i want to make it downloaded and installed at the starting. When i tried including the viewer app in the book list app then both got installed but when i made the apk then using the apk only the book list app is installed. Can anybody tell me what is the issue ? And is there any way to bundle two apk into one ? or what i should do ?

推荐答案

您可以将它们组合成一个项目。

You can combine them into one project.

创建具有基础包名称的包名的项目。例如,如果你目前的应用程序是 com.package.booklist com.package.bookreader 创建的一个项目包 com.package 。现在复制所有code从书单到 com.package.booklist 子包,以及所有code从电子书阅读器到 com.package.bookreader

Create a project which has a package name of a base package name. For example, if your current apps are com.package.booklist and com.package.bookreader create a project with the package com.package. Now copy all the code from the book list into the com.package.booklist sub package, and all the code from the book reader into the com.package.bookreader.

现在你需要结合AndroidManifests。活动> 等元素融入到新项目的清单可以将所有&LT复制。现在,你需要preFIX在读者中的所有类与 .bookreader 和所有类的图书清单 .booklist 。所以你有一个清单,看起来是这样的:

Now you need to combine the AndroidManifests. You can copy all <activity> etc. elements into the new project's manifest. Now, you'll need to prefix all classes in the reader with .bookreader and all the classes in the book list with .booklist. So you'll have a manifest that looks something like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package"
    android:versionCode="1"
    android:versionName="1" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity android:name=".booklist.BookListActivity" >
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" >
                </category>

                <action android:name="android.intent.action.MAIN" >
                </action>
            </intent-filter>
        </activity>

        <activity android:name=".bookreader.BookReaderActivity" >
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" >
                </category>

                <action android:name="android.intent.action.MAIN" >
                </action>
            </intent-filter>
        </activity>
    </application>

</manifest>

删除:

            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" >
                </category>

                <action android:name="android.intent.action.MAIN" >
                </action>
            </intent-filter>

意图过滤器从您不想在启动活动。

intent-filter from the Activity that you don't want in the launcher.

这篇关于将两个APK成一个APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆