2016-09-15 2 views
2

私はRealmに依存しているAndroidライブラリプロジェクトを作成しています。何らかの理由で、レルムを私のGradleファイルに依存関係として追加すると、ビルドエラーが発生します。具体的には:Gradleビルドエラー:Realmを使用しているときにParametersAreNonnullByDefaultクラスファイルにアクセスできません

Error:cannot access ParametersAreNonnullByDefault 
class file for javax.annotation.ParametersAreNonnullByDefault not found 

私はレルムのウェブサイトの開始にちょうど従っています。

私のプロジェクトレベルのbuild.gradleは、次のようになります。

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

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.3' 
     classpath 'io.realm:realm-gradle-plugin:1.2.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

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

私のアプリケーションレベルのgradle.buildは次のようになります。

apply plugin: 'com.android.library' 
apply plugin: 'realm-android' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     minSdkVersion 17 
     targetSdkVersion 24 
     versionCode 9 
     versionName "1.2.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    lintOptions { 
     abortOnError false 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:support-annotations:24.2.0' 
    compile 'com.android.support:support-v4:24.2.0' 
    compile 'com.google.code.gson:gson:2.4' 

    //Puree 
    compile 'com.cookpad.puree:puree:4.1.1' 

    //Square 
    compile 'com.squareup.okhttp3:okhttp:3.2.0' 
    compile 'com.squareup:tape:1.2.3' 
} 

私が間違って何が起こっているか見当がつかない。最初は他の依存関係との間に矛盾があるかもしれないと思っていましたが、同じ依存関係を1つずつ追加する新しいプロジェクトを作成しましたが、コンパイルに問題はありませんでした。

+0

私はプロジェクトをビルドすることができています。全く同じ設定で きれいにしてビルドしましたか? –

+0

うん、きれいにして、それを何度も作りました。運:( – Ventis

+0

アプリを難読化している? –

答えて

1

次の依存関係を追加してみてくださいすることができます

// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 
compile 'com.google.code.findbugs:jsr305:1.3.9' //try also provided 
+0

ですなぜなら、この依存関係を追加するときに働くのですか?答えはThxです。 – Ventis

+0

正直言って私は分かりません。それは 'compile'だけで動作するのでしょうか、' compile '? – EpicPandaForce

+1

はい、それは'提供された 'と同様に働いています:S – Ventis

関連する問題