Gradle错误:意外输入:android.gms:play-services

问题描述 投票:16回答:4

在Gradle中运行时显示错误错误:

错误:任务':app:transformClassesWithInstantRunForDebug'的执行失败。

意外输入:ImmutableJarInput {name = com.google.android.gms:play-services-basement:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 43.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase-analytics:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 37.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.android.gms:play-services-base:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 39.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase :firebase-common:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 41.j ar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase-core:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 36.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.android.gms:play-services-tasks:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 42.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED},ImmutableJarInput {name = com.google.firebase:firebase -analytics-impl:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates / transforms / profilers-transform / debug / 38.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED} ,ImmutableJarInput {name = com.google.firebase:firebase-iid:9.0.0,file = / home / nawaf / AndroidStudioProjects / YugiohDeckBuilder / app / build / intermediates /transforms/profilers-transform/debug/40.jar,contentTypes = CLASSES,scopes = EXTERNAL_LIBRARIES,status = REMOVED}

Gradle项目级别:

dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.0'

    }

gradle app-level:

dependencies {
...
}
apply plugin: 'com.google.gms.google-services'
android android-gradle google-play-services
4个回答
46
投票

您似乎已在Android Studio中启用了Instant Run。

1)禁用从文件 - >设置 - >即时运行的即时运行 2)清理您的项目 3)运行您的应用程序


21
投票

就个人而言,Build => Clean Project然后rebuilding为我修复它。


1
投票

从Project-> app-> build中删除Build文件夹并运行您的项目。


-2
投票

当我添加此行时问题解决了:

        MobileAds.initialize(getApplicationContext(), "ca-app-pub-xxxxxxxxxxxxx");

感谢所有回复者。

© www.soinside.com 2019 - 2024. All rights reserved.