我正在更新android项目中的依赖项。这是一个具有干净架构的多模块项目。 我已经更新了所有的firebase库版本,但是每当我将com.google.gms:google-services的版本从4.1.0更改为4.2.0时,Gradle同步都会失败,错误代码为1。
这是IDE错误的日志-
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at com.google.android.gms.dependencies.DependencyInspector.registerDependencies(DependencyInspector.java:118)
at com.google.android.gms.dependencies.DependencyInspector.afterResolve(DependencyInspector.java:173)
at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:370)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:352)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
2019-03-30 21:54:24,345 [ thread 70] INFO - System.util.ExternalSystemUtil - External project [/Users/d/C/A] resolution task executed in 4840 ms.
2019-03-30 21:54:24,345 [ thread 70] WARN - ect.sync.idea.ProjectSetUpTask - 1
2019-03-30 21:54:24,345 [ thread 70] INFO - e.project.sync.GradleSyncState - Gradle sync failed: 1
项目级Gradle文件-
apply from: 'buildsystem/dependencies.gradle'
apply plugin: 'kotlin'
buildscript {\
ext.kotlin_version = '1.3.21'
repositories {
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
//maven { url 'https://dl.bintray.com/android/android-tools' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.+'
classpath "io.realm:realm-gradle-plugin:5.9.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6"
}
}
allprojects {
ext {
androidProductionApplicationId = '****'
androidStagingApplicationId = '****'
androidVersionCode = 264
androidVersionName = "3.0.0-beta"
}
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.host.url", "http://sonar.****.com/"
property "sonar.login", "*****"
property "sonar.projectKey", "android_test"
property "sonar.language", "java"
property "sonar.sources", "src/main"
}
}
应用级Gradle文件---
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
repositories {
google() //google's maven repo to use firebase and other google services
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
jcenter()
}
android {
def globalConfiguration = rootProject.extensions.getByName("ext")
signingConfigs {
config {
keyAlias 'MyReleaseKey'
keyPassword '****'
storeFile file('../buildsystem/keystore.release.jks')
storePassword '****'
}
debugconfig {
keyAlias 'MyDebugKey'
keyPassword '****'
storeFile file('../buildsystem/keystore.debug.jks')
storePassword '****'
}
}
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion = globalConfiguration.getAt("androidBuildToolsVersion")
defaultConfig {
applicationId globalConfiguration.getAt("androidProductionApplicationId")
versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
multiDexEnabled true
defaultConfig {
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules-presentation.txt'
signingConfig signingConfigs.config
resValue 'bool', 'GHOST_ENABLE', "false"
}
debug {
debuggable true
signingConfig signingConfigs.debugconfig
resValue 'bool', 'GHOST_ENABLE', "true"
}
}
flavorDimensions "default"
productFlavors {
staging {
applicationId globalConfiguration.getAt("androidStagingApplicationId")
resValue 'bool', 'CAN_CHANGE_HOST', "true"
}
production {
applicationId globalConfiguration.getAt("androidProductionApplicationId")
resValue 'bool', 'CAN_CHANGE_HOST', "false"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
useLibrary 'org.apache.http.legacy'
bundle {
language {
enableSplit = false
}
}
androidExtensions {
experimental = true
}
}
sonarqube {
properties {
property "sonar.java.binaries", "build/intermediates/classes/staging/debug"
}
}
dependencies {
def presentationDependencies = rootProject.ext.presentationDependencies
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation project(':data')
implementation project(':domain')
implementation(presentationDependencies.crashlytics) {
transitive = true;
}
implementation(presentationDependencies.multidex)
api(presentationDependencies.gson)
implementation(presentationDependencies.gcm)
implementation(presentationDependencies.fcm)
implementation(presentationDependencies.jsoup)
implementation(presentationDependencies.mixpanel)
implementation(presentationDependencies.facebook)
implementation(presentationDependencies.branch)
implementation(presentationDependencies.cardview)
implementation(presentationDependencies.recyclerview)
implementation(presentationDependencies.fab2)
implementation(presentationDependencies.design)
// implementation(presentationDependencies.appindexing)
implementation(presentationDependencies.eventbus)
implementation(presentationDependencies.exo)
implementation(presentationDependencies.firebaseauth)
implementation(presentationDependencies.firebasedatabase)
implementation(presentationDependencies.firebaseconfig)
implementation(presentationDependencies.firbaseinvites)
kapt(presentationDependencies.daggerCompiler)
implementation(presentationDependencies.rxAndroid)
implementation(presentationDependencies.rxJava2)
implementation(presentationDependencies.rxAndroid2)
implementation(presentationDependencies.butterKnife)
kapt(presentationDependencies.butterKnifeCompiler)
implementation(presentationDependencies.adapterDelegates)
implementation(presentationDependencies.firebaseCore)
implementation(presentationDependencies.fresco)
implementation(presentationDependencies.frescoAnimatedGif)
implementation(presentationDependencies.volley)
implementation(presentationDependencies.dagger)
implementation(presentationDependencies.isoparser)
implementation(presentationDependencies.kotlin)
implementation(presentationDependencies.lifecycle)
implementation(presentationDependencies.appCompat)
implementation(presentationDependencies.facebookShare)
implementation(presentationDependencies.placeAutoComplete)
implementation(presentationDependencies.googlePlayServiceAuth)
implementation(presentationDependencies.realmAdapters)
implementation(presentationDependencies.socketIo) {
exclude group: 'org.json', module: 'json'
}
implementation(presentationDependencies.lifecycleExtensions)
kapt (presentationDependencies.lifecycleCompiler)
implementation(presentationDependencies.constraintLayout)
}
apply plugin: 'com.google.gms.google-services'