1

我有一个使用 dagger 2.8 的项目,该项目与 firebase-messaging 和 firebase-core 库完美配合,但是当我尝试添加新的 firebase-inappmessaging-display 库时,当我尝试编译应用程序时,我有一个匕首错误:

原因:dagger.Provides 缺少元素类型

构建.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions.incremental = false
    defaultConfig {
        applicationId "com.betcris.oficial"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "0.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        renderscriptTargetApi rootProject.ext.targetSdkVersion
        renderscriptSupportModeEnabled true
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }
    buildTypes {
        debug {
            buildConfigField("String", "BASE_URL", "\"http://10.0.2.2:5000/\"")
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            buildConfigField("String", "BASE_URL", "\"http://10.0.2.2:5000/\"")
        }
    }

    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    // multiDex application
    implementation "com.android.support:multidex:$rootProject.multidexVersion"

    // android support libraries
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.supportLibraryVersion"
    implementation "com.android.support:support-vector-drawable:$rootProject.supportLibraryVersion"
    implementation "com.android.support:animated-vector-drawable:$rootProject.supportLibraryVersion"

    implementation 'me.biubiubiu.justifytext:library:1.1'
    implementation group: 'net.databinder', name: 'dispatch-http_2.11', version: '0.8.10'


    //Animation
    implementation 'com.daimajia.easing:library:2.1@aar'

    // facebook
    implementation 'com.facebook.android:facebook-login:4.40.0'

    // circular imageView
    implementation "de.hdodenhof:circleimageview:$rootProject.circularImageVersion"

    // network
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'

    // RxAndroid-retrofit.
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'

    // RxJava
    implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"

    // RxAndroid
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion"

    // image loader
    implementation "com.nostra13.universalimageloader:universal-image-loader:$rootProject.imageLoaderVersion"

    // database
    implementation "android.arch.persistence.room:rxjava2:$rootProject.roomDatabase"
    implementation 'com.android.support:design:28.0.0'
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomDatabase"


    // viewModel and liveData
    implementation "android.arch.lifecycle:extensions:$rootProject.lifecycleVersion"

    // firebase
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
    implementation "com.google.firebase:firebase-core:$rootProject.firebaseVersion"
    implementation 'com.google.firebase:firebase-messaging:17.6.0'

    // dependency injection
    implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


    //toasty
    implementation "com.github.GrenderG:Toasty:$rootProject.toastyVersion"

    //flashbar
    implementation 'com.andrognito.flashbar:flashbar:1.0.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.21"

    // dependencies for local unit tests
    testImplementation "junit:junit:$rootProject.ext.junitVersion"

    // Add dependency
    implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlytics"

    // UI Testing
    androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
    androidTestImplementation "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion"
    implementation 'javax.inject:javax.inject:1'
    compileOnly 'javax.annotation:jsr250-api:1.0'
    implementation 'org.jetbrains:annotations:15.0'

}

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

建造

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.26.1'
        classpath 'com.google.firebase:firebase-plugins:1.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

    }
}

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

ext {
    // Sdk and tools
    minSdkVersion = 21
    targetSdkVersion = 28
    compileSdkVersion = 28

    // App dependencies
    multidexVersion = '1.0.3'
    supportLibraryVersion = '28.0.0'
    circularImageVersion = '3.0.0'
    rx2FastAndroidNetworking = '1.0.1'
    gsonVersion = '2.8.0'
    imageLoaderVersion = '1.9.5'
    roomDatabase = '1.1.1'
    lifecycleVersion = '1.1.1'
    dagger2Version = '2.8'
    rxjava2Version = '2.0.6'
    rxandroidVersion = '2.0.2'
    timberVersion = '4.6.0'
    toastyVersion = '1.2.8'

    firebaseVersion = '16.0.8'
    crashlytics = '2.9.9'

    //Test dependencies
    junitVersion = '4.12'
    espressoVersion = '2.2.2'

    debugDBVersion = '1.0.0'
}

谢谢

4

0 回答 0