未能解决com.google.firebase:firebase-core:10.0.1

时间:2023-01-16 15:18:52

I want to use Firebase Cloud Messaging in my Android App. This is my app level gradle file

我想在我的Android应用中使用Firebase云消息,这是我的App级渐变文件

apply plugin: 'com.android.application'
android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        config1 {
            keyPassword 'android'
        }
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    packagingOptions {
        exclude 'main/AndroidManifest.xml'
    }
    defaultConfig {
        applicationId "com.shikhar.dexter.project"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.google.firebase:firebase-messaging:10.0.1'

    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'

    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.google.android.gms:play-services-auth:9.0.0'

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

This is my root level gradle file

这是我的根级渐变文件

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

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.android.tools.build:gradle:2.1.0'

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

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

While compiling it shows these Errors:

在编译时,它显示了这些错误:

Failed to resolve: com.google.firebase:firebase-core:10.0.1

Error:(36, 13) Failed to resolve: com.google.firebase:firebase-messaging:10.0.1

I tried with various Google Play Services Versions like 9.4.0 but still it doesn't work.

我尝试了各种谷歌播放服务版本,如9.4.0,但仍然不能工作。

6 个解决方案

#1


23  

Open SDK Manager and make sure you have latest "Google Play Services" dependency downloaded.

打开SDK管理器,确保下载了最新的“谷歌播放服务”依赖项。

#2


16  

In addition to downloading the latest "Google Play Services" as suggested by John Oreilly above I also had to update my 'Google Repository' to get it to work.

除了下载上面John Oreilly建议的最新的“谷歌播放服务”之外,我还必须更新我的“谷歌存储库”以使其工作。

In Android Studio go to "Tools -> Android -> SDK manager". In the SDK manager select the tab "SDK Tools" and below "Support Repository" you find 'Google Repository', upgrade it if it's not using the latest version.

在Android Studio中,选择“Tools -> Android -> SDK管理器”。在SDK管理器中选择“SDK工具”选项卡,在“支持存储库”下找到“谷歌存储库”,如果不使用最新版本,则升级它。

#3


5  

Probably needs an update of Google Play Services and Google Repository.

可能需要更新谷歌Play服务和谷歌存储库。

In Android Studio SDK Manager:

在Android Studio SDK管理器中:

  • Select SDK Tools tab
  • 选择SDK工具选项卡
  • Select and install Google Play Services and Google Repository
  • 选择并安装谷歌播放服务和谷歌存储库
  • Sync and Build
  • 同步和构建

see screenshot

看到截图

#4


1  

Try adding all the google dependencies of same version and keep the "Google Play Services" updated in the SDK Manager.

尝试添加相同版本的所有谷歌依赖项,并在SDK管理器中更新“谷歌播放服务”。

compile 'com.google.firebase:firebase-appindexing:10.0.0'
    compile 'com.google.android.gms:play-services-auth:10.0.0'
    compile 'com.google.android.gms:play-services-places:10.0.0'

#5


0  

just had the problem, that with the update from Support Repository v44 to v45 (mid of March 2107); the repository location suddenly changed and therefore some dependencies broke, resulting in quite the same error message (the reason why I want to add this as a possible answer).

刚刚遇到了问题,从支持存储库v44更新到v45(3月2107中旬);存储库位置突然改变,因此一些依赖项中断,导致完全相同的错误消息(这就是为什么我要添加这个作为可能的答案)。

in the Project level build.gradle, the repository v44 was located at:

在项目级别的构建中。储存库v44位于:

repositories {
    maven { url '... /sdk/extras/android/m2repository' }
}

while in the meanwhile, the repository v45 is located at:

同时,储存库v45位于:

repositories {
    maven { url '... /sdk/extras/m2repository' }
}

in order to refresh and to get debug information:

为了刷新和获得调试信息:

./gradlew clean --debug

even with other versions of the repository, it may help to browse the directory structure and compare the location of the repository with the location referenced in the build.gradle, which is supposed to host these dependencies.

即使使用存储库的其他版本,也可以帮助浏览目录结构,并将存储库的位置与构建中引用的位置进行比较。gradle,它应该承载这些依赖关系。

#6


-1  

I Solved this problem in my computer(I use Intelij) what I did is: 1)Go to tools-> SDK manager and update the google play serve and the google repstories. 2)add to the build this maven { url "https://maven.google.com" }under allprojects->repstories

我在我的电脑上解决了这个问题(我使用Intelij),我做的是:1)去工具——> SDK管理器,更新谷歌play serve和谷歌repstories。2)在allprojects->repstories中添加这个maven {url“https://maven.google.com”。

#1


23  

Open SDK Manager and make sure you have latest "Google Play Services" dependency downloaded.

打开SDK管理器,确保下载了最新的“谷歌播放服务”依赖项。

#2


16  

In addition to downloading the latest "Google Play Services" as suggested by John Oreilly above I also had to update my 'Google Repository' to get it to work.

除了下载上面John Oreilly建议的最新的“谷歌播放服务”之外,我还必须更新我的“谷歌存储库”以使其工作。

In Android Studio go to "Tools -> Android -> SDK manager". In the SDK manager select the tab "SDK Tools" and below "Support Repository" you find 'Google Repository', upgrade it if it's not using the latest version.

在Android Studio中,选择“Tools -> Android -> SDK管理器”。在SDK管理器中选择“SDK工具”选项卡,在“支持存储库”下找到“谷歌存储库”,如果不使用最新版本,则升级它。

#3


5  

Probably needs an update of Google Play Services and Google Repository.

可能需要更新谷歌Play服务和谷歌存储库。

In Android Studio SDK Manager:

在Android Studio SDK管理器中:

  • Select SDK Tools tab
  • 选择SDK工具选项卡
  • Select and install Google Play Services and Google Repository
  • 选择并安装谷歌播放服务和谷歌存储库
  • Sync and Build
  • 同步和构建

see screenshot

看到截图

#4


1  

Try adding all the google dependencies of same version and keep the "Google Play Services" updated in the SDK Manager.

尝试添加相同版本的所有谷歌依赖项,并在SDK管理器中更新“谷歌播放服务”。

compile 'com.google.firebase:firebase-appindexing:10.0.0'
    compile 'com.google.android.gms:play-services-auth:10.0.0'
    compile 'com.google.android.gms:play-services-places:10.0.0'

#5


0  

just had the problem, that with the update from Support Repository v44 to v45 (mid of March 2107); the repository location suddenly changed and therefore some dependencies broke, resulting in quite the same error message (the reason why I want to add this as a possible answer).

刚刚遇到了问题,从支持存储库v44更新到v45(3月2107中旬);存储库位置突然改变,因此一些依赖项中断,导致完全相同的错误消息(这就是为什么我要添加这个作为可能的答案)。

in the Project level build.gradle, the repository v44 was located at:

在项目级别的构建中。储存库v44位于:

repositories {
    maven { url '... /sdk/extras/android/m2repository' }
}

while in the meanwhile, the repository v45 is located at:

同时,储存库v45位于:

repositories {
    maven { url '... /sdk/extras/m2repository' }
}

in order to refresh and to get debug information:

为了刷新和获得调试信息:

./gradlew clean --debug

even with other versions of the repository, it may help to browse the directory structure and compare the location of the repository with the location referenced in the build.gradle, which is supposed to host these dependencies.

即使使用存储库的其他版本,也可以帮助浏览目录结构,并将存储库的位置与构建中引用的位置进行比较。gradle,它应该承载这些依赖关系。

#6


-1  

I Solved this problem in my computer(I use Intelij) what I did is: 1)Go to tools-> SDK manager and update the google play serve and the google repstories. 2)add to the build this maven { url "https://maven.google.com" }under allprojects->repstories

我在我的电脑上解决了这个问题(我使用Intelij),我做的是:1)去工具——> SDK管理器,更新谷歌play serve和谷歌repstories。2)在allprojects->repstories中添加这个maven {url“https://maven.google.com”。