Android Studio-Gradle项目同步失败,发生ASCII错误

时间:2019-10-21 16:57:42

标签: android firebase gradle ascii

问题是当我在Android Studio上同步项目时。我按照Fire基本指南上的所有步骤进行操作,发生了“ ASCII”错误。我已经将google-services.json文件粘贴到了app文件夹中。

  

build.gradle(项目:)

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.3.2'

    }
}

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

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

build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.anikr.communityapp"
        minSdkVersion 15
        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'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'

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

3 个答案:

答案 0 :(得分:3)

将以下行添加到gradle.properties

android.overridePathCheck=true

答案 1 :(得分:2)

使用classpath 'com.google.gms:google-services:4.2.0' 并删除firebase-analytics依赖项。 这解决了我的错误。

答案 2 :(得分:0)

将以下行添加到gradle.properties(项目属性)

android.overridePathCheck=true