[英]Android Studio Gradle Sync Failure
我一直在嘗試只運行帶有某些內置視圖的簡單應用程序,但是在Android Studio啟動時,Gradle同步完成時幾乎沒有錯誤。 我嘗試了多種在Internet上看到的方法,但是沒有任何效果。 我還通過下載zip文件並解壓縮從Android Studio文件中替換了gradle-2.14.1文件夾,但這還是行不通的。
這是build.gradle(Project)的代碼:
// 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.2.3'
// 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.gradle(app)的代碼:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.heenamehta.myapplication"
minSdkVersion 15
targetSdkVersion 23
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:23.4.0'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'
}
搖籃 - 包裝 - 屬性:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
我還附有在“消息”部分顯示錯誤的圖像。 這是該圖像,也是有關其他信息,我正在使用:具有SDK API級別23和構建工具25.0.2的Android Studio 2.2.3。
在您的build.gradle
[應用程序級別]中,導入所有這些庫(列在錯誤列表中),並更新您的android studio-
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:23.4.0'
compile 'com.android.support:design:23.4.0'
//Here - add all of those libraries dependencies
testCompile 'junit:junit:4.12'
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.