上传失败:您的免安装应用 APK 应至少包含一个基本 APK [英] Upload failed: Your Instant App APKs should contain at least one base APK
问题描述
我需要为 Instant App 准备一个 Alpha 测试,它在 Android Studio 上运行得很好,但是当我尝试将它上传到 PlayStore 时它失败了,说:
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:
上传失败
您的免安装应用 APK 应至少包含一个基本 APK.
Your Instant App APKs should contain at least one base APK.
应用程序结构使用三个模块完成:
The app structure is done using three modules:
-base:包含所有代码
-apk:包装获取可安装的apk
-apk: Wrapper to obtains the installable apk
-instantApp:获取instantApp apk的封装
-instantApp: Wrapper to obtain the instantApp apk
这是 build.gradles:
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')
}
这是清单文件
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="..." />
这个包与应用的包不同
我已经尝试过这个解决方案:(Android Instant-release build not包括基本 APK) 但它不起作用.
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
提前致谢
P.D:这是我的第一个问题,所以如果我没有正确回答,我很抱歉;)
P.D: Its my first question so I m sorry if I didn't do it propertly ;)
推荐答案
是的!!!我发现了这个问题!!!(而且它不在任何谷歌帮助文档中)
Yeah!!! I found the issue!!!!(and its not in any of the google help documents)
问题是我立即删除了 InstantApp apk 文件.解决方案是使用 InstantApp apk 和基础 apk 创建一个 zip 文件并删除该 zip 文件!!!
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!!!
感谢您的帮助!!!最后,问题不是 gradle 或代码..它是 PlayStore :)
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!!!
这篇关于上传失败:您的免安装应用 APK 应至少包含一个基本 APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!