警告:与依赖关系的冲突“com.android.support:support-annotati
我已经尝试了几乎每一个窍门在书中。
> ResolutionStrategy.force 但没有什么似乎工作,下面是我的build.gradle。我使用Gradle版本1.2.3。有人可以抛出我的代码什么可能是错误的。 我唯一没有尝试的是改变版本的Gradle。 apply plugin: 'com.android.application' android { configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:22.1.0' } compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.example.rasika.job" minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } } } repositories { mavenCentral() } dependencies { compile fileTree(dir: 'libs',include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' testCompile 'junit:junit:4.12' androidTestCompile 'com.android.support.test:runner:0.3' androidTestCompile 'com.android.support.test:rules:0.3' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1' androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0' }
我分叉
android-topeka google sample和更新的appcompat版本为23.1.0,同样的消息:
我补充说: androidTestCompile 'com.android.support:support-annotations:23.1.0' 现在都解决到23.1.0,警告消失了,应用程序和测试仍然工作。 我不确定这是更好的解决方案,所以我正在寻找另一个,但发现了你的问题。 更新:阅读this good explanation by PaulR。 Update2:确认,android-testing google sample。 // Testing-only dependencies // Force usage of support annotations in the test app,since it is internally used by the runner module. androidTestCompile 'com.android.support:support-annotations:23.0.1' Update3:Another good response by CommonsWare。 使用以下方法检查您的特定版本/冲突/ ./gradlew -q yourmodule:dependencies Appcompat是22.1.1在你的情况,但你强迫22.1.0。 更新4: Resolving conflicts between main and test APK
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |