2016-04-19 6 views
5

を見つけることができません。私のモジュールレベルでアンドロイドは、構築しながら、私はこのエラーを取得する領域Gradleの依存関係

classpath "io.realm:realm-gradle-plugin:0.88.3" 

compile 'io.realm:realm-android:0.88.3' 

私のプロジェクトレベルのGradleで
Failed to sync Gradle project 'myapp' 
Error:Could not find io.realm:realm-android:0.88.3. 
Required by: 
    myapp:app:unspecified 

Search in build.gradle files 

私はとして追加されました

このエラーを解決するにはどうすればよいですか?

プロジェクトレベルのGradle:

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

モジュールレベル:以降

apply plugin: 'com.android.application' 
apply from: '../config/quality/quality.gradle' 
apply plugin: 'realm-android' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "xxxxx" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 

    buildTypes { 
     debug { 
      applicationIdSuffix ".debug" 
      versionNameSuffix "-debug" 
      debuggable true 
     } 
     release { 
      minifyEnabled true 
      debuggable false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

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



dependencies { 
    compile 'io.realm:realm-android:0.88.3' 
    //more dependencies here 
} 
+0

から最新のバージョンは、プロジェクトでそのモジュールを追加 –

+1

アプリケーションレベルのbuild.gradleファイルの先頭に、レルムのAndroidプラグインを適用して下さい。 「レルムアンドロイド」 – Dharmaraj

+0

すでに私はすでに –

答えて

8

0.88からレルムはプラグインではなく、コンパイル依存関係ですので、あなたの代わりにプラグインrealm-androidを適用する必要があります。また、ここで説明されていますhttps://realm.io/docs/java/latest/#installation

トップレベルのビルドファイル

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath "io.realm:realm-gradle-plugin:0.88.3" 
    } 
} 

アプリケーションレベルのビルドファイル

あなたのケースで
apply plugin: 'realm-android' 

あなたを削除する必要があります。

dependencies { 
    compile 'io.realm:realm-android:0.88.3' 
} 
+0

現在の最新バージョンを働いたおかげ@Dharmarajここ } –

+1

Hmmが0.84.1から1.0.1に更新されましたが、今ではRealmがまったく見つかりません。私はクラスパスをbuild.gradleで定義し、私のモジュールにプラグインを適用します。モジュールはライブラリですが、それは問題になる可能性がありますか? – Orbit

3

ステップ1:次のクラスパスを追加するプロジェクトレベルのbuild.gradleファイルに追加してください。

buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    //check & update 3.0.0 with latest version 
    classpath "io.realm:realm-gradle-plugin:3.0.0" 
} 
} 

手順2:realm-androidプラグインをアプリケーションレベルのbuild.gradleファイルの先頭に適用します。

apply plugin: 'realm-android' 

https://realm.io/docs/java/latest/

enter image description here

関連する問題