私は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つずつ追加する新しいプロジェクトを作成しましたが、コンパイルに問題はありませんでした。
私はプロジェクトをビルドすることができています。全く同じ設定で きれいにしてビルドしましたか? –
うん、きれいにして、それを何度も作りました。運:( – Ventis
アプリを難読化している? –