Android 上载失败:您的即时应用APK应至少包含一个基本APK
我需要为一个即时应用程序准备一个Alpha测试,它在Android Studio上运行得很好,但当我尝试将它上传到PlayStore时,它失败了,我说: 上载失败 您的即时应用程序APK应至少包含一个基本APK 应用程序结构使用三个模块完成: -base:它包含所有代码 -apk:获取可安装apk的包装器 -instantApp:获取instantApp apk的包装器 这是build.gradles: base/build.gradleAndroid 上载失败:您的即时应用APK应至少包含一个基本APK,android,android-studio,android-gradle-plugin,build.gradle,android-instant-apps,Android,Android Studio,Android Gradle Plugin,Build.gradle,Android Instant Apps,我需要为一个即时应用程序准备一个Alpha测试,它在Android Studio上运行得很好,但当我尝试将它上传到PlayStore时,它失败了,我说: 上载失败 您的即时应用程序APK应至少包含一个基本APK 应用程序结构使用三个模块完成: -base:它包含所有代码 -apk:获取可安装apk的包装器 -instantApp:获取instantApp apk的包装器 这是build.gradles: base/build.gradle buildscript { repositori
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'
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')
}
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':base')
}
apk/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'
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')
}
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':base')
}
instantApp/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'
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')
}
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>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..." />
[…]
)但它不起作用
我从上周五就被困在这里了,所以任何想法都可能很棒
提前谢谢
这是我的第一个问题,所以如果我做得不好,我很抱歉;) 似乎非常接近你想要达到的目标。也许您不需要在base/build.gradle
中使用应用程序项目(“:apk”)
,因为您只有一个特性(即基本拆分)。您还可以尝试删除base=true
涵盖您的用例-但听起来一切都设置正确
你能把你的AndroidManifests
添加到你原来的帖子吗?是的!!!我发现了问题!!!!(而且它不在任何谷歌帮助文档中)
问题是我正在立即删除instantApp apk文件。解决方案是使用instantApp apk和基本apk创建一个zip文件,然后删除该zip文件
谢谢你的帮助!!!最后,问题不是格雷德尔或代码..而是PlayStore:)
我希望如果有人有同样的问题,这个问题可以帮助他们 你的版本代码应该是1我在用不同的APK做测试,所以我把它从1增加到7…无论如何谢谢是的,但我认为这可能是谷歌的意思。没有任何意义,因为如果你要向已经在PlayStore上的应用程序添加即时应用程序,它的版本代码永远不会是1,不是?事实上,我需要一个即时应用程序的版本代码现在是40,所以当我使它工作时,它将是41尝试这个Hi Kyle!!我已经更新了添加清单文件的问题。我现在就给你一个可行的解决方案。谢谢很抱歉,Kyle,我试图删除应用程序项目(“:apk”)
在PlayStore上也是这么说的,如果我删除了base=true
存在一个编译错误,对我来说毫无意义。标签中的属性“split”不是一个有效的拆分名称,我将比较示例项目,以检查我是否做错了什么,并进行检查。ThanksI修改了build.gradle文件,将其设置为示例中的设置,但我遇到了相同的上载失败错误。我开始认为这不是格雷德尔的问题…@CarlosCabelloRuiz嗯,好吧,这是个棘手的问题。听起来很可能是格拉德。你的gradle插件和gradle包装器版本是什么?你也看到这篇文章了吗:stackoverflow.com/a/44367662/1220743这很奇怪……我错误地尝试用instantApp apk上传一个zip文件,它工作了是的,Android Studio将生成一个包含所有即时apk的zip文件。您可以上载zip文件本身,而不是单个APK。