问题
I need to prepare an Alpha testing for an Instant App and It run like a charm on Android Studio but It is failing when I try to upload it to the PlayStore, saying:
Upload failed
Your Instant App APKs should contain at least one base APK.
The app structure is done using three modules:
-base: It contains all the code
-apk: Wrapper to obtains the installable apk
-instantApp: Wrapper to obtain the instantApp apk
This are the build.gradles:
base/build.gradle
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'com.android.feature'
repositories {
jcenter()
mavenCentral()
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "26.0.0-rc2"
baseFeature = true
dataBinding {
enabled = true
}
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 7
versionName "1.1"
}
signingConfigs {
release {
[...]
}
}
buildTypes {
debug {
[...]
}
release {
minifyEnabled false
signingConfig signingConfigs.release
[...]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
application project(":apk")
[...]
}
apply plugin: 'com.google.gms.google-services'
apk/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0-rc2"
dataBinding {
enabled true
}
defaultConfig {
applicationId “…”
minSdkVersion 18
targetSdkVersion 25
versionCode 7
versionName "1.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
[...]
}
}
buildTypes {
debug {
[…]
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
[…]
}
}
}
dependencies {
implementation project(':base')
}
instantApp/build.gradle
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':base')
}
And this are the Manifests files
base/Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=“…”>
<uses-permission android:name="android.permission.INTERNET" />
[…]
<application
android:name=“[…].TrgApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme">
<activity
android:name=“[…].LauncherActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host=“[domain]” />
</intent-filter>
</activity>
<activity
android:name="[…].RootActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="[…].OnBoardingActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="[…].LocationPickerActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name="com.parse.PushService" />
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="[…]" />
</intent-filter>
</receiver>
<meta-data
android:name="com.parse.push.gcm_sender_id"
android:value="id:[…]" />
</application>
</manifest>
apk/Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..." />
This package is different that the app's one
I already tried this solution: (Android Instant-release build not includes base APK) but it didn't work.
I m stuck since the last Friday so any kind of idea could be awesome
Thanks in advance
P.D: Its my first question so I m sorry if I didn't do it propertly ;)
回答1:
Yeah!!! I found the issue!!!!(and its not in any of the google help documents)
The issue was that I was dropping the instantApp apk file straight away. The solution is to create a zip file with the instantApp apk and the base apk and drop that zip file!!!
Thanks for your help!!! At the end the issue wasnt gradle or the code..it was the PlayStore :)
I hope that if anyone has the same problem this question can help them!!!
回答2:
This sample project seems to be pretty close to what you're trying to achieve. Perhaps you don't need the application project(":apk")
in your base/build.gradle
since you only have one feature (and that is the base split). You could also try removing base = true
.
This section of the docs covers your use case - but it sounds like everything is set up correctly.
Could you also add your AndroidManifests
to your original post?
来源:https://stackoverflow.com/questions/44415839/upload-failed-your-instant-app-apks-should-contain-at-least-one-base-apk