0

When trying to launch the Instant App, it reported

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

When look at the logcat, it has this error

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

What did I miss?

Elye
  • 53,639
  • 54
  • 212
  • 474

1 Answers1

2

I think you may have forgetten the baseFeature tag in your base module. If you have a base module and 2 feature modules for examples your gradle should look like these (You need to pay attention to the correct plugins, the baseFeature=true tag and correct dependency declaration).

Base Module Gradle file:

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 module and Feature2 module Gradle files:

apply plugin: 'com.android.feature'

android {
    ...
}

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

Instant App Module Gradle files:

apply plugin: 'com.android.instantapp'

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

Full App Module Gradle files:

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')
}

Non Instant Compatible Module Gradle files:

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

dependencies {
    ...
    implementation project(':base')
}
gbaccetta
  • 4,449
  • 2
  • 20
  • 30
  • i try to understand what a base module is. can you explain what the difference is between a feature module and a base module? The google documentation is not clear on this. – Gillis Haasnoot Jun 28 '17 at 14:21
  • @GillisHaasnoot Instant Apps are based on modularization of your project. A project will have only one Base Module which is the core of your app that will be common to all the other modules. For instance that could contains common resources java code/dependencies such as AppCompat, Analytics, Database and so on... On the other hand features modules will implement specific standalone features of your app that could use the base module as a library but will not use any of the other features. Nice explanation here: https://willowtreeapps.com/ideas/an-introduction-to-android-instant-apps – gbaccetta Jun 28 '17 at 15:35
  • Ok yes i get that. But why do you need to set the base module in your instant app/application?. The features are already using them am i right? Is there really a difference between a library and a base module? – Gillis Haasnoot Jun 29 '17 at 17:13