【问题标题】:Android app is not build successfully, getting "sync failed"Android 应用程序未成功构建,出现“同步失败”
【发布时间】:2019-04-03 08:52:42
【问题描述】:

出现这样的错误。

         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 中,我包含了“implementation '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'

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

                // 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
                }

【问题讨论】:

  • gradle build 失败时显示什么错误?
  • 无法解决:firebase-iid-interop 打开文件无法解决:play-services-basement 打开文件
  • 点击设置-->构建、执行、部署-->编译器--->取消选中“按需配置”,然后清理并重建您的项目。
  • 兄弟清理和构建后出现错误,例如找不到 firebase-iid-interop.aar (com.google.firebase:firebase-iid-interop:16.0.0)。在以下位置搜索:jcenter.bintray.com/com/google/firebase/firebase-iid-interop/…
  • 做什么?请帮帮我。

标签: android firebase android-gradle-plugin firebase-authentication


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-04
    • 2019-06-19
    • 2017-07-18
    • 2021-10-28
    相关资源
    最近更新 更多