Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve hamcrest jar file error in creating new project in android studio

I got this error while creating new project in android studio,I have checked the library and have hamcrest-core-1.3.jar file .Please help me

    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
like image 714
seeta Avatar asked Feb 09 '23 19:02

seeta


2 Answers

the error is not because of hamcrest-core-1.3.jar file. it seems gradle cannot connect to jcenter and download the junit.jar . So, make sure of your internet connection and rebuild your project. normally gradle downloads all necessary jars. if it dosent try to update your build tools.

like image 129
Javad Jafari Avatar answered Feb 11 '23 08:02

Javad Jafari


Try this on your build.gradle Module:app

configurations.all {
        resolutionStrategy {
            force 'org.hamcrest:hamcrest-core:1.3'
        }}

Reference: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

like image 34
Calixto Avatar answered Feb 11 '23 09:02

Calixto