为什么在添加插件com.google.gms.google-services时出现java.lang.ArrayIndexOutOfBoundsException?

时间:2019-02-03 00:00:11

标签: android android-studio

一切正常,我可以在设备上运行该应用,直到我添加apply plugin: 'com.google.gms.google-services'

这是我的Gradle文件

buildscript {
    repositories {
        google()
        maven {url "https://repo1.maven.org/maven2"}
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath files('libs/gradle-witness.jar')
    }
}

apply plugin: 'witness'
apply plugin: 'com.android.application'

repositories {
    maven {url "https://repo1.maven.org/maven2/"}
    maven { url 'https://maven.google.com' }
    jcenter()
    mavenLocal()
    google()
}

subprojects {
    ext.version_number     = "2.4.0"
    ext.group_info         = "org.whispersystems"
    ext.curve25519_version = "0.3.0"
}

dependencies {
    def supportVersion = '28.0.0'

    implementation "com.android.support:appcompat-v7:$supportVersion"
    implementation "com.android.support:recyclerview-v7:$supportVersion"
    implementation "com.android.support:design:$supportVersion"
    implementation "com.android.support:support-v13:$supportVersion"
    implementation "com.android.support:cardview-v7:$supportVersion"
    implementation ("com.android.support:gridlayout-v7:$supportVersion") {
        exclude module: 'support-v4'
    }

    implementation 'se.emilsjolander:stickylistheaders:2.7.0'
    implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
    implementation project (':org.w3c.dom')
    implementation 'info.guardianproject.trustedintents:trustedintents:0.2'
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
    implementation 'com.github.chrisbanes.photoview:library:1.2.3'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.makeramen:roundedimageview:2.1.0'
    implementation 'com.pnikosis:materialish-progress:1.5'
    implementation project (':org.greenrobot.eventbus')
    implementation 'pl.tajchert:waitingdots:0.1.0'

    implementation 'com.melnykov:floatingactionbutton:1.3.0'
    implementation 'com.google.zxing:android-integration:3.1.0'
    implementation project (':com.android.support.support-v4-preferencefragment')

    implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    implementation 'com.annimon:stream:1.1.8'

    implementation 'com.squareup.dagger:dagger:1.2.2'
    implementation ("com.doomonafireball.betterpickers:library:1.5.3") {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'

    implementation project (':org.whispersystems.libpastelog')
    implementation project (':org.whispersystems.libsignal')

    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.7'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.8.7'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.7'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.3.3'

    implementation project (':com.amulyakhare.textdrawable')
    implementation 'me.relex:circleindicator:1.0.0@aar'

    testImplementation 'org.assertj:assertj-core:1.7.1'
    testImplementation 'org.mockito:mockito-core:1.9.5'
    testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
    testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
    testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
    testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'

    androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
    androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
    androidTestImplementation ('org.assertj:assertj-core:1.7.1') {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }
    androidTestImplementation ('com.squareup.assertj:assertj-android:1.0.0') {
        exclude group: 'org.hamcrest',        module: 'hamcrest-core'
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'android.arch.lifecycle:common-java8:1.1.1'
    implementation 'android.arch.work:work-runtime:1.0.0-alpha09'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-ads:17.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.android.support:multidex:1.0.3'

}


/*configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:28.0.0'
    }
}*/

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        versionCode 142
        versionName "0.15.13"

        minSdkVersion 17
        targetSdkVersion 28
        applicationId 'org.smssecure.smssecure'


        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'LICENSE'
        exclude 'NOTICE'
        exclude 'asm-license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }

    signingConfigs {
        release
    }

    buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
            testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
        }
        release {
            minifyEnabled true
            proguardFiles = buildTypes.debug.proguardFiles
            testProguardFiles = buildTypes.debug.testProguardFiles
            signingConfig signingConfigs.release
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
        androidTest {
            java.srcDirs = ['test/androidTest/java']
        }
        test {
            java.srcDirs = ['test/unitTest/java']
        }
    }

     lintOptions {
        abortOnError false
    }

    dexOptions {
        //incremental true
        javaMaxHeapSize "4g"
    }
}

tasks.whenTaskAdded { task ->
    if (task.name.equals("lint")) {
        task.enabled = false
    }
}

/*def Properties props = new Properties()
def propFile = new File('signing.properties')

if (propFile.canRead()){
    props.load(new FileInputStream(propFile))

    if (props !=null &&
        props.containsKey('STORE_FILE')     &&
        props.containsKey('STORE_PASSWORD') &&
        props.containsKey('KEY_ALIAS')      &&
        props.containsKey('KEY_PASSWORD'))
    {
        android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
        android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
        android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
        android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
    } else {
        println 'signing.properties found but some entries are missing'
        android.buildTypes.release.signingConfig = null
    }
}else {
    println 'signing.properties not found'
    android.buildTypes.release.signingConfig = null
}*/

tasks.withType(JavaCompile){
    options.warnings = false
}

apply plugin: 'com.google.gms.google-services'






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.GeneratedMethodAccessor37.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:371)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:353)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:341)
at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:328)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy23.afterResolve(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$4.run(DefaultConfiguration.java:491)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:474)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:459)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1700(DefaultConfiguration.java:116)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguration.java:901)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.access$2700(DefaultConfiguration.java:835)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationArtifactCollection.ensureResolved(DefaultConfiguration.java:1248)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationArtifactCollection.getFailures(DefaultConfiguration.java:1238)
at com.android.build.gradle.internal.ide.ArtifactDependencyGraph.getAllArtifacts(ArtifactDependencyGraph.java:323)
at com.android.build.gradle.internal.ide.ArtifactDependencyGraph.createDependencies(ArtifactDependencyGraph.java:569)
at com.android.build.gradle.internal.ide.ModelBuilder.getDependencies(ModelBuilder.java:588)
at com.android.build.gradle.internal.ide.ModelBuilder.createAndroidArtifact(ModelBuilder.java:666)
at com.android.build.gradle.internal.ide.ModelBuilder.createVariant(ModelBuilder.java:395)
at com.android.build.gradle.internal.ide.ModelBuilder.buildAndroidProject(ModelBuilder.java:339)
at com.android.build.gradle.internal.ide.ModelBuilder.buildAll(ModelBuilder.java:194)
at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:79)
at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:61)
at org.gradle.tooling.internal.consumer.connection.BuildControllerAdapter.getModel(BuildControllerAdapter.java:58)
at org.gradle.tooling.internal.consumer.connection.AbstractBuildController.findModel(AbstractBuildController.java:39)
at org.jetbrains.plugins.gradle.model.ProjectImportAction.addExtraProject(ProjectImportAction.java:123)
at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:76)
at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:40)
at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:53)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.buildResult(ClientProvidedBuildActionRunner.java:79)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.access$000(ClientProvidedBuildActionRunner.java:37)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner$1.buildFinished(ClientProvidedBuildActionRunner.java:56)
at sun.reflect.GeneratedMethodAccessor91.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:371)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:353)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:341)
at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:328)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy16.buildFinished(Unknown Source)
at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:148)
at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:116)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:88)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:84)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.configure(GradleBuildController.java:84)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:64)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)

4 个答案:

答案 0 :(得分:1)

我遇到了同样的错误,但是我试图更改旧版的google-services。

classpath 'com.google.gms:google-services:4.1.0'

但我注意到构建后未创建以下目录

build/generated/res/google-services

所以我降级了。这很好。

classpath 'com.google.gms:google-services:4.0.2'

您的项目似乎未创建“ app”目录(称为模块)。我的项目都没有。我将尝试更改项目结构以升级较新的版本。 https://developer.android.com/images/tools/studio/project-structure_2x.png

之前:

MyApp
-- src/
   -- main/

之后:

MyApp
-- app/
   -- src/
      -- main/

答案 1 :(得分:0)

我在这里进行了所有操作,但唯一能解决问题的方法是重新安装Android Studio。在发布本文时,我目前正在使用AS 3.3。

答案 2 :(得分:0)

我遇到了同样的问题,并通过以下两个步骤解决了该问题。

  1. 下载并更新google-services.json文件。

  2. 将google-services版本更新为4.3.3,这是4.2.0的最新版本。

    dependencies {
    
    classpath 'com.google.gms:google-services:4.3.3'  // Google Services plugin  
    

    }

答案 3 :(得分:-3)

您从Java类中获取错误。数组为空或数组在该位置没有任何值。因此,只需在日志Log.e("keywork","size"+array.size());

中打印数组大小