Java 谷歌服务应用插件错误,解析com.Google.android.gms.11.0.4失败,错误:(45,0)

Java 谷歌服务应用插件错误,解析com.Google.android.gms.11.0.4失败,错误:(45,0),java,android,maven,android-studio,firebase,Java,Android,Maven,Android Studio,Firebase,瞧!希望这足以弥补错误:(45,0)部分 我猜这个问题很简单,我遗漏了一些东西,但这是我的应用程序的build.gradle代码 buildscript { repositories { jcenter() maven { url 'https://maven.google.com' } } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' } } allproje

瞧!希望这足以弥补错误:(45,0)部分

我猜这个问题很简单,我遗漏了一些东西,但这是我的应用程序的build.gradle代码

buildscript {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com'
    }
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
}
}

allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com'
    }
}
}
这是我的应用程序的build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.example.teo.myapplication"
    minSdkVersion 19
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:11.0.4'




testCompile 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'
无论如何。。之前的问题是关于更新谷歌服务插件或添加编译com.google.android.gms:10.2.0或类似的东西,我尝试将编译代码添加到我的应用程序build.gradle中,但错误出现在它的位置,并且有一个按钮,我可以单击它来修复并同步它,但每当我单击它时,我的android都会出现工作室冻结了,过了一会儿就解冻了,什么也没发生

希望我是愚蠢的,这个问题有一个非常简单的解决办法!谢谢大家!

编辑:

我刚刚将
classpath'com.google.gms:google services:3.1.1'
添加到我的build.gradle中,错误更改为“
无法解析:com.google.android.gms:11.0.4
”,我在build.gradle中有这个确切的文件!!!啊

这是错误日志:

                                                      [ 11-30 20:29:26.163   
182:  182 E/         ]
                                                  invalid crash request of 
size 4 (from pid=18086 uid=0)
11-30 20:29:26.403 546-564/? W/qcom_sensors_hal: hal_sensor1_data_cb: 
SENSOR1_MSG_TYPE_BROKEN_PIPE
11-30 20:29:26.437 18271-18271/? E/Diag_Lib:  Diag_LSM_Init: Failed to open 
handle to diag driver, error = 2 
11-30 20:29:26.438 18271-18271/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:29:26.439 18271-18271/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:29:26.468 18271-18273/? W/Sensors: sns_smr_la.c(446):smr_la: 
smr_apps_la_thread_main is starting, fd=11, sns_smr.en_rx_msg_ptr=b6f969d4
11-30 20:29:26.558 18271-18275/? W/Sensors: 
sns_sam_app.c(6827):sns_sam_reg_algo: Registering algo service 16, err 0
11-30 20:29:26.582 18271-18277/? E/Sensors: sns_debug_main.c(565):Debug 
Config File missing in EFS!
11-30 20:29:40.605 1233-18282/? E/ctxmgr: [BaseServerTask]Failed network 
request due to no network connectivity: 
11-30 20:29:40.609 1233-18282/? E/ctxmgr: [AccountAclCallback]Failed Acl 
fetch: network status=1
11-30 20:29:42.609 1808-1898/? D/HeadsetStateMachine: Disconnected process 
message: 10, size: 0
11-30 20:30:15.248 181-534/? D/MDnsDS: MDnsSdListener::Monitor poll timed 
out
1   1-30 20:30:15.248 181-534/? D/MDnsDS: Going to poll with pollCount 1
11-30 20:30:40.757 1233-18311/? E/ctxmgr: [BaseServerTask]Failed network 
request due to no network connectivity: 
11-30 20:30:40.761 1233-18311/? E/ctxmgr: [AccountAclCallback]Failed Acl 
fetch: network status=1
 11-30 20:30:42.929 1808-1898/? D/HeadsetStateMachine: Disconnected process 
 message: 10, size: 0

                                                  [ 11-30 20:31:17.387   
182:  182 E/         ]
                                                  invalid crash request of 
size 4 (from pid=18271 uid=0)
11-30 20:31:17.602 546-564/? W/qcom_sensors_hal: hal_sensor1_data_cb: 
SENSOR1_MSG_TYPE_BROKEN_PIPE
11-30 20:31:17.626 18340-18340/? E/Diag_Lib:  Diag_LSM_Init: Failed to open 
handle to diag driver, error = 2
11-30 20:31:17.626 18340-18340/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:31:17.627 18340-18340/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:31:17.662 18340-18342/? W/Sensors: sns_smr_la.c(446):smr_la: 
smr_apps_la_thread_main is starting, fd=11, sns_smr.en_rx_msg_ptr=b6fe49d4
11-30 20:31:17.749 18340-18344/? W/Sensors: 
sns_sam_app.c(6827):sns_sam_reg_algo: Registering algo service 16, err 0
11-30 20:31:17.771 18340-18346/? E/Sensors: sns_debug_main.c(565):Debug 
Config File missing in EFS!
11-30 20:31:22.729 1152-18348/? I/BgTaskExecutorImpl: Starting EXCLUSIVE 
background task now_calendar_update.
11-30 20:31:23.142 1808-1927/? W/bt-btm: Stopping oneshot timer
11-30 20:31:40.867 1233-18352/? E/ctxmgr: [BaseServerTask]Failed network 
request due to no network connectivity: 
11-30 20:31:40.872 1233-18352/? E/ctxmgr: [AccountAclCallback]Failed Acl 
fetch: network status=1
11-30 20:31:43.248 1808-1898/? D/HeadsetStateMachine: Disconnected process 
message: 10, size: 0
11-30 20:32:41.057 1233-18353/? E/ctxmgr: [BaseServerTask]Failed network 
request due to no network connectivity: 
11-30 20:32:41.065 1233-18353/? E/ctxmgr: [AccountAclCallback]Failed Acl 
fetch: network status=1
11-30 20:32:43.558 1808-1898/? D/HeadsetStateMachine: Disconnected process 
message: 10, size: 0
11-30 20:32:45.904 26912-27049/? I/PlayCommon: [1837] 
com.google.android.play.a.h.e(248): Preparing logs for uploading
11-30 20:32:45.905 26912-27049/? I/PlayCommon: [1837] 
com.google.android.play.a.h.e(252): No file ready to send

                                           [ 11-30 20:33:08.722   182:  182 
E/         ]
                                           invalid crash request of size 4 
(from pid=18340 uid=0)
11-30 20:33:08.913 546-564/? W/qcom_sensors_hal: hal_sensor1_data_cb: 
SENSOR1_MSG_TYPE_BROKEN_PIPE
11-30 20:33:08.948 18397-18397/? E/Diag_Lib:  Diag_LSM_Init: Failed to open 
handle to diag driver, error = 2  
11-30 20:33:08.949 18397-18397/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:33:08.950 18397-18397/? E/Sensors: sns_fsa_la.c(386):fsa: fflush 
failed, 9
11-30 20:33:08.974 18397-18399/? W/Sensors: sns_smr_la.c(446):smr_la: 
smr_apps_la_thread_main is starting, fd=11, sns_smr.en_rx_msg_ptr=b6f219d4
11-30 20:33:09.052 18397-18401/? W/Sensors: 
sns_sam_app.c(6827):sns_sam_reg_algo: Registering algo service 16, err 0
11-30 20:33:09.073 18397-18403/? E/Sensors: sns_debug_main.c(565):Debug 
Config File missing in EFS!
11-30 20:33:14.493 26912-26953/? I/PlayCommon: [1790] 
com.google.android.play.a.h.e(248): Preparing logs for uploading
11-30 20:33:14.593 26912-26953/? I/PlayCommon: [1790] 
com.google.android.play.a.h.a(470): Connecting to server: 
https://play.googleapis.com/play/log?format=raw&proto_v2=true
11-30 20:33:14.599 26912-26953/? E/PlayCommon: [1790] 
com.google.android.play.a.h.a(500): Failed to connect to server: 
java.net.UnknownHostException: Unable to resolve host "play.googleapis.com": 
No address associated with hostname
11-30 20:33:41.168 1233-18309/? E/ctxmgr: [BaseServerTask]Failed network 
request due to no network connectivity: 
11-30 20:33:41.176 1233-18309/? E/ctxmgr: [AccountAclCallback]Failed Acl 
fetch: network status=1

我敢肯定真正的错误已经接近尾声了!!请帮助

将其添加到项目级
build.gradle
文件中:

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

您需要更改这行代码:

compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:11.0.4'


所有依赖项必须是同一版本。

除了现在我有原始错误外,其他都有效!当它出现在build.gradle中时,它说“未能解析:com.google.android.gms:11.0.4”,看起来它应该正常工作!
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:11.0.4'