我的build.gradle应用程序开始崩溃时遇到问题

时间:2018-12-03 17:04:20

标签: java android android-gradle build.gradle

我试图将google广告添加到我的应用中,但是用gradle却出错了。 两行代码用红色下划线标出。

implementation 'com.android.support:appcompat-v7:27.1.1'

,并显示以下消息:所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本27.1.1、26.1.0。示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:customtabs:26.1.0

这:

implementation 'com.google.android.gms:play-services-ads:17.1.1'

并显示消息:所有gms / firebase库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本17.1.1、16.0.4、16.0.3、16.0.1、16.0.0。示例包括com.google.android.gms:play-services-ads:17.1.1和com.google.android.gms:play-services-measurement-base:16.0.4

我的build.gradle(项目):

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

}
}

allprojects {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
     }
   }
 }

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

然后build.gradle(模块):

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.user.app"
    minSdkVersion 21
    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'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
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'
 }

0 个答案:

没有答案
相关问题