无法构建gradle并创建java类
我的android工作室中的任何项目都无法构建。错误信息如下 –
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)
此外,我无法通过File-> new-> Java类在android studio中创建一个新的java类,因为没有这样的选项可用。 我找到了一些答案说右键单击java文件夹,然后单击标记目录为 – > SOURce root,即使此选项也不存在。 此外,为了解决gradle问题,我发现一些答案说单击文件 – >无效缓存/重新启动并删除主目录中的.gradle文件然后更新android studio,我做了相应但仍然无效。 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' }
gradle-wrapper.properties的内容是 –
#Tue Mar 28 20:10:53 IST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
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 }
在做Build-> Clean项目这个错误信息显示 –
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
我甚至卸载了Android-Studio 2.3并安装了2.2.2,但问题仍然存在
- 错误:(2,0)找不到ID为’jetty’的插件
- Android studio中的构建gradle错误
- Fragment null必须是要从实例状态正确重新创建的公共静态类
- Android Studio Gradle:执行静态Java方法(从ANT迁移到Gradle)
- RecyclerView滚动时滞后
- Android设备监视器无法从Android Studio或终端启动 – UnsupportedClassVersionError
- 为什么编译时库模块中的包不存在,即使Android Studio在代码中没有显示错误?
- 如何设置Android Mock GPS位置?
- 如何在Android Studio中添加Snap to Roads Google Map