错误:无法解析Android应用程序模块的Gradle Config [英] Error: Could not parse the Android application Module's Gradle Config

查看:40
本文介绍了错误:无法解析Android应用程序模块的Gradle Config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在Android项目中设置Firebase.问题是,我一直收到此错误:

I've been trying to setup Firebase in my Android project. Problem is, I've been getting this error:

无法解析Android应用程序模块的Gradle Config

Could not parse the Android application Module's Gradle Config

我真的解决不了.

我已经看到很多人遇到此错误,但是似乎他们可以通过升级其构建工具版本或更新google-services来解决该错误.我已经做完了所有事情,但到目前为止还无法完成工作.

I've seen quite a lot of people getting this error, but it seems that they could solve it by upgrading their build tool version, or by updating google-services. I've done all that and haven't been able to make it work so far.

这是我的Gradle脚本:

Here are my Gradle scripts:

apply plugin: 'com.android.application'

android {
signingConfigs {
    AndroidAppPro {
    }
}
compileSdkVersion 25
buildToolsVersion '26.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.critizr.pro"
    minSdkVersion 14
    targetSdkVersion 25
    versionCode 9
    versionName "1.5.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
productFlavors {
    preprod {
        applicationId "com.cr.pro"
        buildConfigField 'boolean', 'IS_PROD', 'false'
        buildConfigField 'String', 'HOST', '"https://myurl.com/"'
    }
    prod {
        applicationId "com.cr.pro"
        buildConfigField 'boolean', 'IS_PROD', 'true'
        buildConfigField 'String', 'HOST', '"https://myurl/"'
    }
}
packagingOptions {
     exclude 'META-INF/DEPENDENCIES.txt'
     exclude 'META-INF/LICENSE.txt'
     exclude 'META-INF/NOTICE.txt'
     exclude 'META-INF/NOTICE'
     exclude 'META-INF/LICENSE'
     exclude 'META-INF/DEPENDENCIES'
     exclude 'META-INF/notice.txt'
     exclude 'META-INF/license.txt'
     exclude 'META-INF/dependencies.txt'
     exclude 'META-INF/LGPL2.1'
   }
}

dependencies {
compile project(':lib-viewflow')

// new libs
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'

compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.2'
//compile 'com.google.android.gms:play-services-analytics:11.0.1'

compile 'org.apache.httpcomponents:httpclient:4.1'
compile 'org.apache.httpcomponents:httpmime:4.1'

compile 'com.joshdholtz.sentry:sentry-android:1.5.0'
compile 'com.borax12.materialdaterangepicker:library:1.6'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.cloudinary:cloudinary-core:1.2.2'
compile 'com.cloudinary:cloudinary-android:1.2.2'
compile 'com.loopj.android:android-async-http:1.4.5'
}
 apply plugin: 'com.google.gms.google-services'

第二个:

 buildscript {
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}
 dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'
    classpath 'com.google.gms:google-services:3.1.0'
}
}

allprojects {
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}
}

推荐答案

要在 Android Studio v3.1 上解决此问题(不确定以前的版本),只需编辑应用程序的内部版本即可.gradle 像这样:

To solve this on Android Studio v3.1 (not sure about previous versions), just edit your app's build.gradle like this:

  • 寻找:应用插件:"com.google.gms.google-services" ,然后删除,然后进行同步.现在,您可以毫无问题地使用Firebase Assistant.
  • Look for: apply plugin: 'com.google.gms.google-services' and remove it then sync. Now you'll be able to use the Firebase Assistant with no issues.

这篇关于错误:无法解析Android应用程序模块的Gradle Config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆