错误:找不到符号类BR

时间:2017-04-01 08:57:52

标签: android dagger-2

我在组装图书馆项目时遇到了问题。我已经建立了一个应用项目&后来把它转换成了库。我无法生成.aar包。我在这里找到的答案很少,可以告诉你改变 apt neenbedankt插件,附上数据绑定:编译器,但这对我来说根本不起作用。有人可能会说匕首是问题,但我不确定。请帮忙。

  • 这是我在构建构建时的错误日志

    Information:Gradle tasks [assemble]
    /home/***/***/**/**/productlisting/viewmodel/ProductListFragmentViewModel.java
    Error:(9, 52) error: cannot find symbol class BR
    /home/***/***/**/**/home/viewmodel/NavSubItemViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/productlisting/viewmodel/NavSubItemViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/home/topbrands/BrandActivityViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/productlisting/viewmodel/ProductListActivityViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/home/viewmodel/NewArrivalViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/home/viewmodel/NavParentItemViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    /home/***/***/**/**/productlisting/viewmodel/NavParentItemViewModel.java
    Error:(3, 52) error: cannot find symbol class BR
    Error:Execution failed for task :app:compileLiveDebugJavaWithJavac.
    Compilation failed; see the compiler error output for details.
    Information:BUILD FAILED
    Information:Total time: 6.519 secs
    Information:9 errors
    Information:0 warnings
    Information:See complete output in console
    
    • 这是我的模块级别 build.gradle

``

apply plugin: 'com.android.library'
apply plugin: 'io.fabric'  def gitSha = 'git rev-parse --short HEAD'.execute([],    project.rootDir).text.trim()
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
    minSdkVersion 19
    targetSdkVersion 25
    versionCode 1
    versionName getCurrentVersion()
    vectorDrawables.useSupportLibrary = true
    manifestPlaceholders = [hostNameDeepLink: "http://***.**.in:203/api/"]
    buildConfigField "String", "CodeRevision", "\"{$gitSha}\""
    multiDexEnabled true
    renderscriptTargetApi 19
    renderscriptSupportModeEnabled true

}
testOptions {
    unitTests.returnDefaultValues = true
}
packagingOptions {
    pickFirst 'META-INF/rxjava.properties'
}

signingConfigs {
    planet {
        storeFile file('../****.jks')
        storePassword '***@123'
        keyAlias '***'
        keyPassword '***@123'
    }
}
dataBinding {
    enabled = true
}
lintOptions {
    disable 'InvalidPackage'
    abortOnError false
}
dexOptions {
    jumboMode true
}
productFlavors {
    local {
        String WebServiceUrl = getWebServiceUrl()
        String WebSitePath = getWebSitePath()
        String ImageUrl = getImageUrl()
        String ServerName = getServerName()
        String TestCustomerId = getWebSitePath()
        buildConfigField "String", "WebServiceUrl", "\"$WebServiceUrl\""
        buildConfigField "String", "WebSitePath", "\"$WebSitePath\""
        buildConfigField "String", "ImageUrl", "\"$ImageUrl\""
        buildConfigField "String", "ServerName", "\"$ServerName\""
        buildConfigField "String", "TestCustomerId", "\"$TestCustomerId\""
        manifestPlaceholders = [hostNameDeepLink: "http://10.160.0.18"]
    }
    live {
        String WebServiceUrl = getWebServiceUrl()
        String WebSitePath = getWebSitePath()
        String ImageUrl = getImageUrl()
        String ServerName = getServerName()
        String TestCustomerId = getWebSitePath()
        buildConfigField "String", "WebServiceUrl", "\"$WebServiceUrl\""
        buildConfigField "String", "WebSitePath", "\"$WebSitePath\""
        buildConfigField "String", "ImageUrl", "\"$ImageUrl\""
        buildConfigField "String", "ServerName", "\"$ServerName\""
        buildConfigField "String", "TestCustomerId", "\"$TestCustomerId\""
        /*buildConfigField "String", "WebServiceUrl", "\"http://perfectmother.zoomi.in:203/api/\""
        buildConfigField "String", "WebSitePath", "\"http://perfectmother.zoomi.in:203/\""
        buildConfigField "String", "ImageUrl", "\"http://perfectmother.zoomi.in:203\""
        buildConfigField "String", "ServerName", "\"-Live\""
        buildConfigField "String", "TestCustomerId", "\"10086\""*/
        manifestPlaceholders = [hostNameDeepLink: "http://perfectmother.zoomi.in"]

    }
}
buildTypes {
    release {
        signingConfig signingConfigs.planet
        shrinkResources true
        minifyEnabled true
        zipAlignEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable false
    }
    debug {
        signingConfig signingConfigs.planet
        debuggable true
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
    }
}
}

def static getCurrentVersion() {

def buildEnv = System.getenv("BUILD_NUMBER")

def buildNumber = buildEnv != null ? ".${buildEnv}" : ""

return "1.0" + buildNumber

}

def getWebServiceUrl() {
return hasProperty('WebServiceUrl') ? WebServiceUrl : ''
}

def getWebSitePath() {
    return hasProperty('WebSitePath') ? WebSitePath : ''
}

def getImageUrl() {
    return hasProperty('ImageUrl') ? ImageUrl : ''
}

def getServerName() {
    return hasProperty('ServerName') ? ServerName : ''
}

def getTestCustomerId() {
    return hasProperty('TestCustomerId') ? TestCustomerId : ''
}

ext {
    playServiceVersion = '10.2.1'
    supportLibVersion = '25.3.1'
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:$supportLibVersion"

// Unit testing
testCompile 'org.robolectric:robolectric-resources:3.0'
testCompile 'org.robolectric:shadows-core:3.2.2'
testCompile 'org.robolectric:robolectric:3.2.2'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.6.3'
//Hamcrest
testCompile 'org.hamcrest:hamcrest-all:1.3'

//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'

//Zoomi library
compile 'com.zoomi.android:utils:1.0'
compile 'com.zoomi.android:rxutils:1.5.1'

//CardView:
compile "com.android.support:cardview-v7:$supportLibVersion"

//RecyclerView:
compile "com.android.support:recyclerview-v7:$supportLibVersion"

//Design
compile "com.android.support:design:$supportLibVersion"

//Glide
compile 'com.github.bumptech.glide:glide:3.7.0'

//Dagger
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'

//Auto Value
annotationProcessor 'com.google.auto.value:auto-value:1.3'
provided 'com.google.auto.value:auto-value:1.3'

//Auto Value GSON
annotationProcessor 'com.ryanharter.auto.value:auto-value-gson:0.4.6'
provided 'com.ryanharter.auto.value:auto-value-gson:0.4.6'

//Auto Value Parcelable
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
provided 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'

//Rx
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'

//Timber
compile 'com.jakewharton.timber:timber:4.3.1'

//FOR CI
compile "com.google.firebase:firebase-core:$playServiceVersion"

//Fire base crash reporting
compile "com.google.firebase:firebase-crash:$playServiceVersion"

//Fire base authentication
compile "com.google.firebase:firebase-auth:$playServiceVersion"
compile "com.google.android.gms:play-services-auth:$playServiceVersion"

//bottom bar
compile 'com.aurelhubert:ahbottomnavigation:2.0.4'

//Groupie
compile 'com.genius:groupie:0.8.0'

//PageIndicator
compile 'com.romandanylyk:pageindicatorview:0.1.1'

//FiftyShadesOf
compile 'com.github.florent37:fiftyshadesof:1.0.0'

//Proguard Snippets
compile 'com.github.PrashamTrivedi:ProguardSnips:0.1-snapshot'

//ProGuard rules for RxJava!
compile 'com.artemzin.rxjava:proguard-rules:1.2.4.0'

//Facebook
compile 'com.facebook.android:facebook-android-sdk:4.19.0'

//Twitter
compile('com.twitter.sdk.android:twitter:2.3.1@aar') {
    transitive = true
}

// Crop image
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'

//Show case
compile 'com.github.deano2390:MaterialShowcaseView:1.1.0'

//GSON
compile 'com.google.code.gson:gson:2.8.0'

//Constraint layout
compile 'com.android.support.constraint:constraint-layout:1.0.2'

//Firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:10.2.0'

}

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'io.fabric.tools:gradle:1.22.1'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        maven { url 'http://**.***.**.**:81/release/' }
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.fabric.io/public' }
    }
}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:-1)


“ BR”导入文件丢失。

在模型类中添加以下导入文件:

import com.yourpackagename.BR;