错误:连接超时:连接

时间:2017-11-20 14:09:48

标签: android firebase android-gradle

我正在学校开展我的项目,我需要在Firebase上连接我的应用程序。我正在使用Android Studio 2.3.3。在应用程序和firebase之间的连接期间,使用Firebase助手,没有问题。当我添加依赖项时,我的gradle因此错误而失败。

build.gradle(Module:app)文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
    applicationId "com.example.user.conread"
    minSdkVersion 19
    targetSdkVersion 26
    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:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    testCompile 'junit:junit:4.12'
}


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

错误是

  

错误:连接超时:连接

虽然我收到了这个错误,但它显示在助手

  

依赖关系设置正确。

感谢您的帮助。

3 个答案:

答案 0 :(得分:0)

In my case Windows 10 firewall blocked android studio and I've got the same message.

Error:Connection timed out: connect.

Maybe it will help someone.

答案 1 :(得分:0)

一些解决方案:

1 Build - >清洁项目

2 Build - >重建项目

3内置 - >制作项目

4从设备中删除您的应用程序并尝试重新安装

5 Mb你的app的实际版本存在一些问题(尝试拉实际分支)。如果您的应用程序正在运行,您也可以检查您的emmulator。

6尝试使用1,2,3,4解决方案。

答案 2 :(得分:0)

转到您的build.gradle文件,然后删除存储库中的google()。然后再试一次。您的项目将成功运作。

相关问题