我想将 firebase 添加到我的项目中,这是我的依赖项:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.3.3'
implementation 'androidx.navigation:navigation-ui:2.3.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'io.reactivex.rxjava2:rxjava:2.2.11'
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
//Retrofit
implementation "com.squareup.retrofit2:retrofit:${retrofit_version}"
implementation "com.squareup.retrofit2:converter-gson:${retrofit_version}"
implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit_version}"
//http interceptor
implementation "com.squareup.okhttp3:okhttp:${interceptor_version}"
implementation "com.squareup.okhttp3:logging-interceptor:${interceptor_version}"
// Material Dialog Library
implementation 'com.shreyaspatil:MaterialDialog:2.1'
// Material Design Library
implementation 'com.google.android.material:material:1.3.0'
// Lottie Animation Library
implementation 'com.airbnb.android:lottie:3.4.0'
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0"
// Annotation processor
kapt "androidx.lifecycle:lifecycle-compiler:2.3.0"
implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
// For Kotlin use kapt instead of annotationProcessor
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.2.6"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
//dagger
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
//http interceptor
implementation "com.squareup.okhttp3:okhttp:${interceptor_version}"
implementation "com.squareup.okhttp3:logging-interceptor:${interceptor_version}"
//Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
implementation 'com.google.android.material:material:1.3.0'
//Kodein Dependency Injection
implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1"
implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1"
implementation 'com.github.dhaval2404:imagepicker:1.7.5'
implementation 'com.github.gcacace:signature-pad:1.2.1'
// implementation 'com.google.android.gms:play-services:17.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.airbnb.android:lottie:3.4.0'
implementation 'com.github.mayuce:LottieAlertDialog:1.1'
implementation 'com.applandeo:material-calendar-view:1.7.0'
implementation 'com.applandeo:material-calendar-view:1.9.0-alpha03'
implementation 'com.applandeo:material-calendar-view:1.9.0-alpha03'
//Rx java
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.11'
//dexter
implementation 'com.karumi:dexter:6.2.2'
//Location
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.hbb20:ccp:2.4.0'
implementation 'com.github.prabhat1707:EasyWayLocation:2.0'
//Aws
implementation 'com.amazonaws:aws-android-sdk-s3:2.18.0'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.18.0'
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.18.0'
implementation 'com.github.mukeshsolanki:Google-Places-AutoComplete-EditText:0.0.8'
// implementation project(':maplibrary')
implementation 'com.google.android.libraries.places:places:2.4.0'
implementation 'org.jetbrains.anko:anko-support-v4-commons:0.10.8'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.bitvale:lightprogress:1.0.1'
implementation 'com.github.timigod:android-chat-ui:v0.1.4'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
implementation 'com.github.bassaer:chatmessageview:2.0.1'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
// implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation platform('com.google.firebase:firebase-bom:26.5.0')
// Declare the dependencies for the Firebase Cloud Messaging and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
但是当我想添加 firebase 时出现此错误:
Failed to resolve: com.google.android.gms:play-services-measurement-sdk:12.0.1
Show in Project Structure dialog
Affected Modules: app
我还在应用级别和 build.gradle 项目级别中将 apply plugin: 'com.google.gms.google-services'
添加到 build.gradle
的底部:
// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.gms:google-services:4.3.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://www.jitpack.io" }
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "12.0.1"
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:-1)
我通过将所有包更新到最新版本解决了我的问题,并从应用级别和项目级别的 build.gradle 文件中删除了一些代码,如下所示:在项目级别的 build.gradle:
foreach (var category in sortedCategories)
if (givenString.EndsWith(category))
{
//true category found. do something
break;
}
应用级的build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.2"
classpath 'com.google.gms:google-services:4.3.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}