as gradle 编译错误解决办法

时间:2022-08-31 14:47:35

这些as工程,报错,为了以后,好找答案,总结如下:保持更新并

1.

Resolved versions for app (23.4.0) and test app (23.1.1) differ.
具体的报错:
Warning:Conflict with dependency ‘com.android.support:support-annotations’. Resolved versions for app (23.4.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Error:Execution failed for task’:app:prepareDebugAndroidTestDependencies’.


也就是说“support-annotations”报了错,
我的引用:
androidTestCompile “com.android.support:support-annotations:$rootProject.supportLibraryVersion”
网络解决案例
后来就将一些testcompile给注释就好了,具体,还是项目的gradle配置不大了解,我后一篇就写一个gradle的;

2.

Error:Failed to resolve: junit:junit:4.12
href=”openFile:E:/AndroidExampleSjt4444/android-architecture-todo-mvp/app/build.gradle”
Open File href=”open.dependency.in.project.structure”>Show in Project Structure dialog

解决办法:
其实这个错误并非把testCompile ‘junit:junit:4.12’注释或删除掉,在*中有明确的原由和解决方法,只需在Application的gradle文件中添加maven { url ‘http://repo1.maven.org/maven2’ }
as gradle 编译错误解决办法