2017-09-05 3 views
1

を解決できません。 Add Componentsの指示に従うと、自分のFragmentにRoomクラスを使用することはできません。ルーム永続ライブラリ:私はRxRoomが、設立余地クラスを検索することができ、次のGradleの設定</p> <p>とAndroidのメーカー3.0ベータ2を使用したシンボルルーム

このクラスは個別のモジュールにあり、appモジュールにはルームライブラリの依存関係は含まれていません。

IDEで「シンボルルームを解決できません」というエラーが表示されました。

enter image description here

build.gradle

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 


    defaultConfig { 
     minSdkVersion 15 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     javaCompileOptions { 
      annotationProcessorOptions { 
       arguments = ["room.schemaLocation": 
            "$projectDir/schemas".toString()] 
      } 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    compileOptions { 
     targetCompatibility 1.8 
     sourceCompatibility 1.8 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.0.2' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
    implementation 'com.android.support:design:26.0.2' 
    implementation 'com.android.support:support-v4:26.0.2' 
    implementation 'com.android.support:recyclerview-v7:26.0.2' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    implementation "android.arch.persistence.room:runtime:1.0.0-alpha9" 
    annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9" 
    testImplementation "android.arch.persistence.room:testing:1.0.0-alpha9" 
    implementation "android.arch.persistence.room:rxjava2:1.0.0-alpha9" 
} 

更新 私が最初alpha8に部屋のライブラリをダウングレードしようとしたとルームクラスはすぐに戻ってきます。なぜこのクラスがalpha9で消えたのかわかりませんが、少なくとも回避策です。

答えて

2

apiimplementationからすべてRoom依存関係を変更してください、私はコンパイル時のエラーを持っている私もAPKを実行できることがわかります。コンパイルエラーを解決するために、次の方法で問題を解決しようとしました。

implementation "android.arch.persistence.room:compiler:1.0.0-alpha9" 

そして次Disable the error check from Migrate to Android Plugin for Gradle 3.0

javaCompileOptions { 
    annotationProcessorOptions { 
     includeCompileClasspath = true 
    } 
} 
0

週間の試験後build.gradle

+0

を追加する

変更

annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9" 

私は "API" が、運であることをランタイムとrxjava2を変更 –

関連する問題