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

查看:38
本文介绍了将两个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 创建一个项目.现在将图书列表中的所有代码复制到 com.package.booklist 子包中,并将图书阅读器中的所有代码复制到 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.您可以将所有 等元素复制到新项目的清单中.现在,您需要使用 .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天全站免登陆