Any project in my Android studio cannot build. The error message is as follows:
Gradle sync failed: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.3-all.zip'. Consult IDE log for more details (Help | Show Log)
In addition, I cannot create a new java class in android studio using the class File-> new-> Java, since this option is not available. I found the answers to them by right-clicking on the java folder and then clicking Mark Directory as → SOurce root, even this parameter is not. Moreover, to solve the gradle problem, I found several answers that said that click “File” - “Invalid cache” / “Restart” and delete the .gradle file in the home directory and then update Android studio, I did it, but nothing works anyway. build.gradle -
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.example.android.iitmandi" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.2.0' compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5' testCompile 'junit:junit:4.12' }
Content gradle -wrapper.properties -
Build.grale -
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
when running Build-> Clean project this error message was shown -
Error:A problem occurred configuring project ':app'. > Could not resolve all dependencies for configuration ':app:_debugUnitTestApkCopy'. > Could not resolve junit:junit:4.12. Required by: project :app > Could not resolve junit:junit:4.12. > Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. > Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out
I even uninstalled Android-Studio 2.3 and installed 2.2.2 instead, but the problem still persists.
source share