android - gradle.build文件中的问题

标签 android firebase gradle firebase-realtime-database

这是我的gradle.build代码,正在收到未找到库之类的问题,并在我更改为最新版本后更新该版本,还获得了初学者并为我的最后一年项目创建聊天应用程序的消息。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "afterapps.com.firebaseim"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    jcenter()
    maven{
        url "https://maven.google.com"
    }
}
repositories {
    jcenter()
    mavenCentral()
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    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.1.0'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'jp.wasabeef:glide-transformations:2.0.1'
    implementation 'frankiesardo:icepick:3.2.0'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.jakewharton:butterknife:8.4.0'
    implementation 'com.zsoltsafrany:needle:1.0.0'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    provided 'frankiesardo:icepick-processor:3.2.0'
    implementation 'joda-time:joda-time:2.9.7'
}



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

https://github.com/MahmoudAlyuDeen/FirebaseIM

最佳答案

这些依赖关系通常已经过时了... Gradle包装器应该是5.4.1

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://clojars.org/repo/" }
        maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
        mavenCentral()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
com.android.support仅适用于不使用androidx的Firebase库版本:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.afterapps.firebaseim"
        minSdkVersion 21
        targetSdkVersion 28
        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:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    // https://firebase.google.com/support/release-notes/android#2019-06-17
    //noinspection GradleDependency
    implementation 'com.google.firebase:firebase-messaging:19.2.0'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-database:19.2.0'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'jp.wasabeef:glide-transformations:2.0.1'
    implementation 'frankiesardo:icepick:3.2.0'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.zsoltsafrany:needle:1.0.0'
    implementation 'com.jakewharton:butterknife:8.4.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compileOnly 'frankiesardo:icepick-processor:3.2.0'
    implementation 'joda-time:joda-time:2.9.7'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
}

关于android - gradle.build文件中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59700654/

相关文章:

android - 设置 LinearLayout 可见并调用 getBottom

ios - 将Firebase Admin SDK添加到Swift

c# - 将 JSON 反序列化为可读格式

java - Gradle子项目构建依赖

java - 有什么方法可以让 IntelliJ IDEA 在 Java 项目中识别 Dagger 2 生成的类?

Android 6.0 Marshmallow 如何禁用/隐藏 Navigationbar/SystemUI

android - 当我卸载我的应用程序时,我们可以删除通过我的应用程序创建的文件夹吗?

gradle - gradle:无法获取任务的未知属性 'runtimeClasspath'

java - 使用复选框。复选框字符串值将在选中时传输到 edittext

javascript - 如何在谷歌云功能中获取使用node js调整大小的图像的下载网址?