【发布时间】:2016-02-25 23:56:19
【问题描述】:
我刚刚在我的 android studio 项目中启用了instant run。 (关注instructions here)
我的项目包含 git 子模块,不知何故这些不再编译。
这是我得到的错误:
错误:(8, 0) 无法更改配置的依赖关系 ':libraries:my_library:classpath' 解决后。
知道那里可能有什么问题吗?
顶级 build.gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
classpath 'com.novoda:bintray-release:0.2.7'
classpath 'io.fabric.tools:gradle:1.+'
}}
模块 build.gradle:
apply plugin: 'android'
apply plugin: 'io.fabric'
android {
defaultConfig {
versionCode 4850
versionName '4850'
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
useLibrary 'org.apache.http.legacy'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
[skip]
compile project(':libraries:my_library:sdk')
}
库构建.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
testCompile 'junit:junit:4.12'
}
【问题讨论】:
-
你能把你的
build.gradle文件包括进来吗? -
尝试移除织物,看看是否是造成混乱的原因,对所有模块也使用相同的 buildToolsVersion
-
@HiI'mFrogatto 完全是……这就是我刚才在回答中提到的。
-
@passsy 上面发布的 gradle 文件是否完全符合您的情况?从下面的一些 cmets 看来,虽然您有相同的错误消息,但您的项目结构(具有两个顶级 build.gradle 文件)与上面的问题不同。您可以根据您的具体情况更新此问题,但实际上,您应该在一个全新的问题中发布您的代码。
标签: android android-studio gradle android-gradle-plugin