我们正准备发布我们的即时应用,但是,在尝试运行我们的AIA应用以及尝试上传到Google Play中的AIA开发轨道时,我们遇到了问题。这是我们第一次遇到这个问题但过去能够运行AIA。经过进一步调查,似乎我们的基本功能apk以某种方式被多次添加或引用。任何帮助表示赞赏。
Android Studio错误:
Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split null was defined multiple times
Google Play错误:
Your Instant App APKs cannot contain more than one base APK.
AIA build.gradle文件
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
apply plugin: 'com.android.instantapp'
apply plugin: 'io.fabric'
repositories {
google()
jcenter()
flatDir {
dirs '../libs'
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
android {
compileSdkVersion rootProject.compileSdk
buildToolsVersion rootProject.buildTools
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
}
buildTypes {
debug {
}
release {
}
}
flavorDimensions rootProject.flavorDimensions
productFlavors {
flavor1 {
applicationId rootProject.flavor1PackageName
versionCode rootProject.flavor1VersionCode
versionName rootProject.flavor1VersionName
dimension rootProject.flavorDimensions
}
flavor2 {
applicationId rootProject.flavor2PackageName
versionCode rootProject.flavor2VersionCode
versionName rootProject.flavor2VersionName
dimension rootProject.flavorDimensions
}
}
}
dependencies {
implementation project(':features:base')
implementation project(':features:chat')
implementation project(':features:message')
implementation project(':features:search')
}
基本功能build.gradle
apply plugin: 'com.android.feature'
repositories {
google()
jcenter()
flatDir {
dirs '../../libs'
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
android {
baseFeature true
compileSdkVersion rootProject.compileSdk
buildToolsVersion rootProject.buildTools
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
vectorDrawables.useSupportLibrary true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
flavor1Release {
storeFile file('../../publish/flavor1-release.keystore')
storePassword System.getenv("FLAVOR1_STORE_PASSWORD")
keyAlias System.getenv("FLAVOR1_KEY_ALIAS")
keyPassword System.getenv("FLAVOR1_KEY_PASSWORD")
v2SigningEnabled true
}
flavor2Release {
storeFile file('../../publish/flavor2-release.keystore')
storePassword System.getenv("FLAVOR2_STORE_PASSWORD")
keyAlias System.getenv("FLAVOR2_KEY_ALIAS")
keyPassword System.getenv("FLAVOR2_KEY_PASSWORD")
v2SigningEnabled true
}
debug {
storeFile file('../../publish/debug.keystore')
}
}
flavorDimensions rootProject.flavorDimensions
productFlavors {
flavor1 {
versionCode rootProject.flavor1VersionCode
versionName rootProject.flavor1VersionName
dimension rootProject.flavorDimensions
}
flavor2 {
versionCode rootProject.flavor2VersionCode
versionName rootProject.flavor2VersionName
dimension rootProject.flavorDimensions
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
productFlavors.flavor1.signingConfig signingConfigs.flavor1Release
productFlavors.flavor2.signingConfig signingConfigs.flavor2Release
}
}
}
dependencies {
feature project(':features:chat')
feature project(':features:message')
feature project(':features:search')
application project(':app')
api 'com.android.support:appcompat-v7:26.0.1'
api 'com.android.support:design:26.0.1'
api 'com.android.support:cardview-v7:26.0.1'
api 'com.google.android.gms:play-services-maps:11.0.2'
api 'com.google.android.gms:play-services-gcm:11.0.2'
api 'com.google.android.gms:play-services-location:11.0.2'
api 'com.google.android.gms:play-services-auth:11.0.2'
api 'com.google.firebase:firebase-core:11.0.2'
api 'com.google.firebase:firebase-config:11.0.2'
api...
}
apply plugin: 'com.google.gms.google-services'
其他功能模块build.gradle文件(都是完全相同的)
apply plugin: 'com.android.feature'
repositories {
google()
jcenter()
flatDir {
dirs '../../libs'
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
android {
lintOptions {
abortOnError false
}
compileSdkVersion rootProject.compileSdk
buildToolsVersion rootProject.buildTools
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
vectorDrawables.useSupportLibrary true
}
signingConfigs {
flavor1Release {
storeFile file('../../publish/flavor1-release.keystore')
storePassword System.getenv("FLAVOR1_STORE_PASSWORD")
keyAlias System.getenv("FLAVOR1_KEY_ALIAS")
keyPassword System.getenv("FLAVOR1_KEY_PASSWORD")
v2SigningEnabled true
}
flavor2Release {
storeFile file('../../publish/flavor2-release.keystore')
storePassword System.getenv("FLAVOR2_STORE_PASSWORD")
keyAlias System.getenv("FLAVOR2_KEY_ALIAS")
keyPassword System.getenv("FLAVOR2_KEY_PASSWORD")
v2SigningEnabled true
}
debug {
storeFile file('../../publish/debug.keystore')
}
}
flavorDimensions rootProject.flavorDimensions
productFlavors {
flavor1 {
versionCode rootProject.flavor1VersionCode
versionName rootProject.flavor1VersionName
dimension rootProject.flavorDimensions
}
flavor2 {
versionCode rootProject.flavor2VersionCode
versionName rootProject.flavor2VersionName
dimension rootProject.flavorDimensions
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
productFlavors.flavor1.signingConfig signingConfigs.flavor1Release
productFlavors.flavor2.signingConfig signingConfigs.flavor2Release
}
}
}
dependencies {
api project(':features:base')
}
构建拆分apk工件后,这是解压后的结构:
aia-release.zip
- base-release.apk
- chat-release.apk
- message-release.apk
- search-release.apk
在Android Studio中检查zip文件时,一切似乎都是正确的,并且符合Google提供的围绕AIA,多种功能和多种口味的多个示例。
其他信息:
Android Studio 3.0 Beta 2
Gradle plugin: 3.0.0-beta2
Gradle wrapper distribution: 4.1-rc-1
修改
我们已设法识别有关该问题的更多信息。运行多特征示例时,生成的工件具有缺少工件的几个关键组件。但是,我们使用相同的配置,插件等。
在构建任何示例项目时,生成的合并清单包含以下我们没有的标记。
android:isFeatureSplit="true"
split="<name>"
但是,我们的合并清单只会添加标记:
featureSplit="<name>"
我们仍在努力确定这种情况发生的原因以及我们的项目设置/结构有何不同。但这是一个艰苦的过程,因为AIA周围的文档数量有限。
要了解更多信息。
编辑2:
在完成项目结构的更多工作后,现在看来我们的基本APK资源无法通过我们的功能模块清单识别。这是特定于AIA,而不是常规&#34;已安装&#34;模块。编译正常的已安装模块时,不会发生此问题。
错误:
No resource found that matches the given name...
遗憾的是,目前还没有关于此的文档。我们似乎是唯一遇到这些问题的团队。
最终修改(已解决):
不要,我再说一遍,你的gradle.properties文件中没有这个
android.enableAapt2=false
这是我们遇到的所有问题的唯一原因。