【问题标题】:My Target SDK version is 29 and MinSdk version is 15. Help me to provide the fit firebaseUI dependency我的 Target SDK 版本是 29,MinSdk 版本是 15。帮我提供适合的 firebaseUI 依赖
【发布时间】:2020-03-22 16:07:15
【问题描述】:

当我放置firebaseui的依赖项时,我无法在gradle文件中提供匹配的firebaseui,它给出了错误,例如合并文件等

1.build.gradle

apply plugin: 'com.android.application'

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

android {
    compileSdkVersion 29

    buildToolsVersion "29.0.2"

    defaultConfig {

        applicationId "com.example.smartcommittee"

        minSdkVersion 15

        targetSdkVersion 29

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'androidx.appcompat:appcompat:1.0.2'

    implementation 'de.hdodenhof:circleimageview:3.0.1'

    api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'

    implementation 'com.android.support:design:29.0.0'

    implementation 'com.android.support:cardview-v7:29.0.0'

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'com.google.firebase:firebase-auth:16.0.5'

    implementation 'com.google.firebase:firebase-database:16.0.4'

    implementation 'com.google.firebase:firebase-storage:16.0.4'

    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'androidx.test.ext:junit:1.1.0'

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation files('libs/picasso-2.0.0.jar')
}

【问题讨论】:

标签: android firebase android-studio gradle build.gradle


【解决方案1】:

你需要使用以下依赖:

    implementation 'com.firebaseui:firebase-ui-database:6.1.0'

由于您使用的是androidx 依赖项,因此请将firebase 依赖项更新为以下内容,因为您不能将旧的android 依赖项与androidx 混合使用:

implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-storage:19.1.0'

您可以查看以下链接了解更多信息:

如何迁移到 androidx:

https://developer.android.com/jetpack/androidx/migrate

FirebaseUI 和 firebase 发行说明:

https://github.com/firebase/FirebaseUI-Android

https://firebase.google.com/support/release-notes/android

【讨论】:

  • 它仍然无法工作,出现合并错误(错误:清单合并失败:uses-sdk:minSdkVersion 15 不能小于库 [com.google.firebase:firebase-auth:19.2. 0] C:\Users\Farman Ullah\.gradle\caches\transforms-2\files-2.1\7c78a11c6b4a4456334831db0797030d\firebase-auth-19.2.0\AndroidManifest.xml 因为库可能正在使用 15 中不可用的 API 建议:使用minSdk 最多为 15 的兼容库,或者将此项目的 minSdk 版本增加到至少 16,
  • 将项目minsdk增加到16
  • minSdkVersion 16
【解决方案2】:

您可以更改配置 来自

defaultConfig {
        applicationId "com.example.ShareIt"
        minSdkVersion 15 //here you got error
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

defaultConfig {
        applicationId "com.example.ShareIt"
        minSdkVersion 16 //change 15 to 16, it is compatible with all dependencies
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

它有效;-)

【讨论】:

    猜你喜欢
    • 2019-12-25
    • 2019-09-10
    • 2019-05-06
    • 1970-01-01
    • 1970-01-01
    • 2016-09-18
    • 2022-01-22
    • 2018-09-24
    • 1970-01-01
    相关资源
    最近更新 更多