【发布时间】:2016-04-19 07:45:34
【问题描述】:
我在构建时收到此错误:
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 中,我添加了:
classpath "io.realm:realm-gradle-plugin:0.88.3"
在我的模块级别:
compile 'io.realm:realm-android:0.88.3'
如何解决这个错误?
项目级分级:
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
}
【问题讨论】:
-
将该模块添加到您的项目中
-
将 realm-android 插件应用到应用层 build.gradle 文件的顶部。应用插件:'realm-android'
-
@M D 我已经添加了
-
@Dhamaraj 我已经这样做了
-
移除这个依赖{ compile 'io.realm:realm-android:0.88.3' //这里有更多依赖}