Gradle 同步失败:创建进程错误 = 2,系统找不到指定的文件



我正在使用 android studio 3.0,我从 http://www.androidbootstrap.com 下载了一个项目,当我导入该项目时,它给我的错误是"Gradle 同步失败:创建进程错误 = 2,系统找不到指定的文件"。 这种类型的问题和相应的答案已经发布,但由于我发布这个问题,它们都没有解决我的问题,请理解这一点。

Gradle Script>build.gradle 是:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
jcenter()
}
}

app\build.gradle 是:

buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'io.fabric.tools:gradle:1.19.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
maven { url 'https://github.com/donnfelker/mvn-repo/raw/master/' }
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
def computeVersionCode() {
if (System.env.BUILD_NUMBER) {              // Check if there is a system build number.
return "$System.env.BUILD_NUMBER".toInteger()
} else if (System.env.CIRCLE_BUILD_NUM) {   // Check to see if this is built on circle CI
return "$System.env.CIRCLE_BUILD_NUM".toInteger()
} else {
return 1                                // if none is found, default to 1.
}
}
def computeVersionName() {
return "1." + computeVersionCode()
}
//noinspection GroovyUnusedAssignment
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
versionCode computeVersionCode()
versionName computeVersionName()
// Enable this if you want to use Build.GIT_SHA in your code somewhere.
// This will give you the last GIT_SHA that was committed
// buildConfigField "String", "GIT_SHA", ""${gitSha}""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'LICENSE.txt'
}
signingConfigs {
// Uncomment and set values and then this will work
//         release {
//             storeFile file(System.getenv('ANDROID_KEYSTORE_PATH'))
//             storePassword System.getenv('ANDROID_STORE_PASS')
//             keyAlias System.getenv('ANDROID_KEY_ALIAS')
//             keyPassword System.getenv('ANDROID_KEY_PASS')
//         }
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
applicationIdSuffix '.debug'
minifyEnabled false
// zipAlign false // this is default for debug
}
release {
// minifyEnabled true
// proguardFile '..proguard.cfg'
// signingConfig signingConfigs.release
// zipAlign true // this is default for release
// testPackageName 'example.com.tests'
// testInstrumentationRunner 'android.test.InstrumentationTestRunner' // this is the default
}
}
}
dependencies {
// Android Support Libs
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.code.gson:gson:2.3'
// Dependency Injection
compile 'com.google.dagger:dagger:2.0'
// View Injection
compile 'com.jakewharton:butterknife:7.0.1'
// Logging
compile 'com.jakewharton.timber:timber:3.0.2'
compile 'com.actionbarsherlock:viewpagerindicator:2.4.1'
compile 'com.nineoldandroids:library:2.4.0'
// Event Bus
compile 'com.squareup:otto:1.3.5'
// Image Loading
compile 'com.squareup.picasso:picasso:1.1.1'
// HTTP
compile 'com.squareup.retrofit:retrofit:1.5.1'
// Fabric/Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
transitive = true
}
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Contrib
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
// http://stackoverflow.com/a/30931887/5210
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
apt 'com.google.dagger:dagger-compiler:2.0'
provided 'javax.annotation:jsr250-api:1.0'
}

请尝试项目的代理设置。

最新更新