Android studio 如何解决在android studio中创建新项目时出现的hamcrest jar文件错误
我在android studio中创建新项目时遇到了这个错误,我已经检查了库并得到了hamcrest-core-1.3.jar文件。请帮助我Android studio 如何解决在android studio中创建新项目时出现的hamcrest jar文件错误,android-studio,jar,hamcrest,Android Studio,Jar,Hamcrest,我在android studio中创建新项目时遇到了这个错误,我已经检查了库并得到了hamcrest-core-1.3.jar文件。请帮助我 Error:A problem occurred configuring project ':app'. > Could not download hamcrest-core.jar (org.hamcrest:hamcrest-core:1.3) > Could not get resource 'https://jce
Error:A problem occurred configuring project ':app'.
> Could not download hamcrest-core.jar (org.hamcrest:hamcrest-core:1.3)
> Could not get resource 'https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar'.
> Could not GET 'https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar'.
> jcenter.bintray.com
该错误不是由hamcrest-core-1.3.jar文件引起的。gradle似乎无法连接到jcenter并下载junit.jar。因此,请确保您的internet连接并重建您的项目。通常,gradle会下载所有必要的jar。如果没有,请尝试更新您的构建工具。在您的构建上尝试此操作。升级模块:应用程序
configurations.all {
resolutionStrategy {
force 'org.hamcrest:hamcrest-core:1.3'
}}
参考资料:根据我的经验,当我创建一个新项目时,我遇到了这个问题。 为了修复它,我从build.gradle模块:app中删除了下面的依赖项
testCompile 'junit:junit:4.12'
之后,重新构建项目,问题就再也没有出现。从build.gradle模块中删除以下行:依赖项下的app
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
我以前也遇到过同样的问题,在我的案例中,gradle无法访问jar存储库 您可能需要:
转到gradle.properties并对所有SystemProxy和resync进行注释 这是我的工作
- 安卓2.3.3
- 在以下情况下禁用渐变脱机模式
文件>设置>生成、执行、部署>
全局渐变设置
禁用脱机工作最好添加一个解释,说明为什么删除这些行会有帮助,这对我来说真的很有效。荣誉但为什么呢?这背后有什么解释吗?