Android应用无法成功构建,导致“同步失败”

时间:2018-10-30 10:25:28

标签: android firebase android-gradle firebase-authentication

遇到这样的错误。

         Could not find firebase-iid-interop.aar (com.google.firebase:firebase-iid-interop:16.0.0).
         Searched in the following locations:
         https://jcenter.bintray.com/com/google/firebase/firebase-iid-interop/16.0.0/firebase-iid-interop-16.0.0.aar

获取API错误,例如:

        {
          "errors" : [ {
            "status" : 404,
            "message" : "Could not find resource"
          } ]
        }

这是我的应用gradle文件。应用程式使用了Firebase-id。我根据程序更改了程序包名称,但同步失败。

在Gradle中,我添加了“实现'com.google.firebase:firebase-core:16.0.1'”,但没有用

            apply plugin: 'com.android.application'

            android {
                compileSdkVersion 25
                buildToolsVersion '28.0.2'

                defaultConfig {
                    applicationId "com.my.application"
                    minSdkVersion 15
                    targetSdkVersion 25
                    versionCode 14
                    versionName "2.7"
                    vectorDrawables.useSupportLibrary = true

                }

                buildTypes {
                    release {
                        minifyEnabled false


                    }
                }
            }

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


                implementation fileTree(dir: 'libs', include: ['*.jar'])
                testImplementation 'junit:junit:4.12'
                implementation 'com.google.firebase:firebase-core:16.0.1'
                implementation 'com.google.android.gms:play-services-base:9.2.1'
                implementation 'com.google.android.gms:play-services-basement:9.2.1'
                implementation 'com.google.android.gms:play-services-safetynet:9.2.1'
                implementation 'com.google.android.gms:play-services-tasks:9.2.1'


                //  implementation 'com.google.android.gms:play-services-safetynet:11.0.1'

                // ButterKnife
                implementation 'com.jakewharton:butterknife:8.8
                annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

                // Volley
                implementation 'com.android.volley:volley:1.1.0'

                implementation 'com.github.aakira:expandable-layout:1.4.2@aar'
                implementation 'com.android.support:appcompat-v7:25.3.1'
                implementation 'com.android.support:design:25.3.1'
                implementation 'com.android.support:cardview-v7:25.3.1'
                implementation 'com.android.support:recyclerview-v7:25.3.1'
                implementation 'com.android.support:support-v4:25.3.1'
                implementation 'com.android.support:support-vector-drawable:25.3.1'
                implementation 'com.google.android.gms:play-services-maps:9.2.1'
                implementation 'com.google.android.gms:play-services-places:9.2.1'
                implementation 'com.google.code.gson:gson:2.8.1'
                implementation 'com.balysv:material-ripple:1.0.2'
                implementation 'com.github.bumptech.glide:glide:3.7.0'
                implementation 'com.wdullaer:materialdatetimepicker:3.2.0'
                implementation 'com.mikhaellopez:circularimageview:3.0.2'
                implementation 'com.github.pchmn:MaterialChipsInput:1.0.5'
                implementation 'com.hootsuite.android:nachos:1.1.1'
                implementation 'com.android.support.constraint:constraint-layout:1.0.2'
                implementation 'com.google.firebase:firebase-messaging:9.2.1'
                implementation 'com.squareup.retrofit2:retrofit:2.0.2'
                implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
                implementation 'com.squareup.picasso:picasso:2.3.2'
                implementation 'com.nineoldandroids:library:2.4.0'
                implementation 'com.daimajia.slider:library:1.1.5@aar'
                implementation 'com.felipecsl:gifimageview:2.1.0'
                implementation 'commons-io:commons-io:2.4'
                implementation files('libs/YouTubeAndroidPlayerApi.jar')
                implementation 'com.paytm:pgplussdk:1.1.5'
                implementation 'com.sunfusheng:marqueeview:1.2.0'

                // library for user interface

                implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'

                // firebase ads library
            //    implementation 'com.google.firebase:firebase-ads:9.2.1'

                implementation 'com.android.support:multidex:1.0.3'


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

具有依赖性的Gradle文件使用了“ classpath'com.google.gms:google-services:4.0.1'”

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

                buildscript {
                    repositories {
                        jcenter()
                        mavenCentral()
                        google()
                    }
                    dependencies {
                        classpath 'com.android.tools.build:gradle:3.2.0'
                        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 {
                        jcenter()
                        mavenCentral()
                        maven { url "https://jitpack.io" }
                        google()
                    }
                }

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

1 个答案:

答案 0 :(得分:1)

例如,下载最新的Gradle软件包分发版(gradle-2.11-all.zip)。 将项目加载到Android Studio中,然后转到“文件”->“设置”->“渐变”。单击“使用本地Gradle发行版”,然后将其指向解压缩最新Gradle项目的文件夹。 重新启动您的项目。

相关问题