我正在尝试将Firebase推送通知添加到应用程序。我从带有“基本活动”的新应用开始,但是遇到错误
首先我在gradle构建期间遇到了以下错误
错误:任务':app:preDebugAndroidTestBuild'的执行失败。
与以下项中的依赖项“ com.android.support:support-annotations”冲突 专案':app'。应用(26.1.0)和测试应用(27.1.1)的已解决版本 不同。参见https://d.android.com/r/tools/test-apk-dependency- 有关详细信息,请参阅flicts.html。 然后我在应用程序级别的build.gradle中添加了依赖性,并解决了问题
implementation 'com.android.support:support-annotations:27.1.1'
compileSdkVersion 28
得到解决
从26 in app gradle build 执行任务失败 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'。 com.android.builder.dexing.DexArchiveMergerException:无法合并dex
我尝试了一些解决方案,但没有一个对我有用。
应用程序级别build.gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rakesh.firecast"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
multi
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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
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.android.support:support-annotations:27.1.1'
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
项目级别build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
请帮助我解决并解决此问题