i installed Android Studio latest version on windows 10.(what i already did with another version and another windows 10) it's OK with android SDK but when it wants to load a project it said this:
Error:(23, 17) Failed to resolve: junit:junit:4.12
and here's the log:
JsonSyntaxException: Parse exception while reading distributions.json: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
gradle.build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.mohammad.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}
For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.
Android Developers get "Gradle project sync failed" or "Gradle sync failed" error in Android Studio when project gradle is unable to sync properly. This maybe caused due to a number of reasons including incorrent versions in project settings, corrupt cache, network problems and wrong dependencies. Gradle sync fail error happens commonly due to ...
For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.
We came across several cases where the online distribution was not working as expected and failed the Gradle sync. Another workaround to this issue is to download the Gradle distribution manually and make use of that. Follow the steps below: Download the latest version of Gradle from the official Gradle Release Website.
1 Method 1: Restarting your project using Invalidate Caches and Restart option. In this method, we will be restarting our project using Invalidate Caches and Restart option. ... 2 Method 2: Sync your project with Gradle files. ... 3 Method 3: Deleting and installing new Gradle files. ...
add the following lines
android {
...
...
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
...
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With