gpt4 book ai didi

android - 无法获取 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'

转载 作者:行者123 更新时间:2023-12-03 04:17:00 29 4
gpt4 key购买 nike

在Firebase身份验证(助手)中使用将Firebase身份验证添加到您的应用程序时出错。

该错误在“同步”标签中显示为:

Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'. Received status code 405 from server: Method Not Allowed Enable Gradle 'offline mode' and sync project



我的Android Studio详细信息是:
  • Android Studio版本3.2.1
  • Gradle版本:4.6


  • build.gradle(项目)
    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {

    repositories {
    google()
    jcenter()
    maven { url 'https://dl.bintray.com/android/android-tools' }
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
    }

    allprojects {
    repositories {
    google()
    jcenter()
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }

    build.gradle(应用程序)
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'

    android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "com.nsc.suyog.myotp1"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
    }

    最佳答案

    尝试更改以下代码(项目):

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {

    repositories {
    google()
    maven { url "http://jcenter.bintray.com"}
    maven { url 'https://dl.bintray.com/android/android-tools' }
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'com.google.gms:google-services:4.2.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
    }

    allprojects {
    repositories {
    google()
    maven { url "http://jcenter.bintray.com"}
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }

    和(应用程序):
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'

    android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "com.nsc.suyog.myotp1"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    android { lintOptions { abortOnError false }

    aaptOptions {
    cruncherEnabled = false

    }

    }

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-auth:16.1.0'
    }

    另外,在 gradle-wrapper.properties 中,添加以下行或更改为已经存在的其他值:
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

    关于android - 无法获取 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54231922/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com