问题
I am unable to run my app in instant app mode, while if i run application module it works fine. But as i select instant app module it runs but white screen appears.
Created project by using built in instant app support of android studio
Following this video : https://www.youtube.com/watch?v=9Jg1D07NgeI&t=569s and several blogs , code lab instruction and other tutorials on youtube
feature module is empty app module don't contain any activity only base module contains single activity
app : gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.anilsharma92.myintantapp.app"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':base')
}
base gradle
apply plugin: 'com.android.feature'
android {
compileSdkVersion 27
baseFeature true
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api 'com.android.support:appcompat-v7:27.1.1'
api 'com.android.support.constraint:constraint-layout:1.1.2'
application project(':app')
}
instant app gradle :
apply plugin: 'com.android.instantapp'
android {
compileSdkVersion 27
}
dependencies {
implementation project(':base')
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.anilsharma92.myintantapp.app">
</manifest>
base : manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.anilsharma92.myintantapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="aia-compat-api-min-version"
android:value="1" />
<activity android:name=".SplashActivity">
<intent-filter
android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="anilsharma92.000webhostapp.com"
android:scheme="https"
android:pathPattern="/splash" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
asset json file
回答1:
Why are you including your app Module inside the base module?
application project(':app')
- it shouldn't!
If there is part of code of the app, you want to use it inside the base module. You should create another module. A library module to contain you common part, this module will be include by the app and the base module.
来源:https://stackoverflow.com/questions/50966879/unable-to-run-instant-app-from-android-studio