Reputation: 1411
Im new to testing in android studio, im was trying to setup the gradle for adding dependencies for Junit4.
However, the gradle console informs me "Could not find junit:junit:4.12."
It seems like gradle search the dependency in local folder instead of via internet, please inform how I should setup the gradle file for adding the dependecy for Junit.
Upvotes: 1
Views: 9375
Reputation: 11
Try commenting out //testCompile 'junit:junit:4.12'
.
This will solve the problem if you don't have internet access as you run app after installing Android Studio. As soon as you have internet access, uncomment and run your app, there after everything remains fixed won't be needing internet access again.
I'm sure it works. Not sure why, anyway.
Upvotes: 1
Reputation: 17841
You have in your build.gradle:
buildscript {
repositories {
mavenCentral()
}
}
The above will fetch the plugin com.android.application
. That's all it will do.
You should have the below to fetch all your dependencies
:
repositories {
mavenCentral()
}
Upvotes: 0
Reputation: 3046
You need internet connection -at least first time- to build project first time correctly (i really don't know why) !!!
so, to avoid that you may try download JUnit (required library) from here and add it manually to your application into ~[YourAppFolder]\app\libs
then rebuild your app.
Upvotes: 2