Android app is not build successfully, getting "sync failed"
出现这样的错误。
1 2 3 | 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 错误,例如:
1 2 3 4 5 6 | { "errors" : [ { "status" : 404, "message" :"Could not find resource" } ] } |
这是我的应用程序 gradle 文件。应用程序使用了 firebase-id。我根据程序更改了包名称,但同步失败。
在 Gradle 中,我包含了 "implementation \\'com.google.firebase:firebase-core:16.0.1\\'" 但不起作用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 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\\'"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | // 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 软件包发行版 (gradle-2.11-all.zip)。
在 Android Studio 中加载您的项目,然后转到 File->Settings->Gradle。单击使用本地 Gradle 分发并将其指向您解压缩最新 Gradle 项目的文件夹。
重新启动您的项目。