0

尝试启动即时应用程序时,它报告

Side loading failed with message: Failure when trying to read bundel. 
Failed to parse app: /data/local/tmp/aia/my_app.zip

当查看logcat时,它有这个错误

InstantAppBundleException: No base split found! 
Base split APK is the one with no 'splitName' attribute set on the <manifest> tag

我错过了什么?

4

1 回答 1

2

我认为您可能忘记了基本模块中的 baseFeature 标签。如果您有一个基本模块和 2 个功能模块作为示例,您的 gradle 应该如下所示(您需要注意正确的插件、baseFeature=true 标记和正确的依赖项声明)。

基本模块Gradle 文件:

apply plugin: 'com.android.feature'

android {
    //this is mandatory for the base module of the project
    baseFeature = true
    ...
}

dependencies {
    ...
    feature project(':feature1')
    feature project(':feature2')
    application project(':hello-installed')
}

Feature1 模块Feature2 模块Gradle 文件:

apply plugin: 'com.android.feature'

android {
    ...
}

dependencies {
    ...
    implementation project(':base')
}

Instant App 模块Gradle 文件:

apply plugin: 'com.android.instantapp'

dependencies {
    implementation project(':base')
    implementation project(':feature1')
    implementation project(':feature2')
}

完整的应用模块Gradle 文件:

apply plugin: 'com.android.application'

android {
    //classic gradle declaration for legacy apps
}

dependencies {
    implementation project(':base')
    implementation project(':feature1')
    implementation project(':feature2')

    //non instant libraries will only appear here
    implementation project(':nonInstantLibrary')
}

非即时兼容的模块Gradle 文件:

//it will use the legacy library plugin
apply plugin: 'com.android.library'

dependencies {
    ...
    implementation project(':base')
}
于 2017-06-28T10:39:30.740 回答