Android Studio 2.2 新建项目常见问题

来源:互联网 发布:葛底斯堡演说 知乎 编辑:程序博客网 时间:2024/05/19 20:39

1.Error:Could not download hamcrest-core.jar (org.hamcrest:hamcrest-core:1.3): No cached version avail

   创建好项目后,编辑一部分代码编译时发生如上错误,通过查找百度和查找资料发现,是因为最新的创建项目会使用junit库来进行代码测试,在下载这个库的内容的时候发现他引用了hamcrest这个框架,不过国内下载这个框架的hamcrest-core.jar不成功(博主电脑没有翻墙)。

  尝试方法1

 

In my experience, When I created a new project I encountered this issue. To fix it I removed the dependency below from build.gradle Module:app.

testCompile 'junit:junit:4.12'

After that and rebuild project the problem never happened.


  结果还是报错。

  尝试方法2

将 bulid.gradle module:app中dependencies的下面代码删除

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {    exclude group: 'com.android.support', module: 'support-annotations'})

还有

testCompile 'junit:junit:4.12'
都删除

重新点击Try again

发现错误消失了


0 0
原创粉丝点击