2017-05-30 183 views
0

我一直在試圖用一些內置視圖運行一個簡單的應用程序,但在Android Studio啓動時,Gradle同步完成時幾乎沒有錯誤。我試過了在互聯網上看到的多種方法,但沒有任何效果。我還從Android Studio文件中替換了gradle-2.14.1文件夾,通過下載zip文件並解壓縮,但這不起作用。Android Studio Gradle同步失敗

下面是的build.gradle(項目)的代碼:

// 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 

我還附加了在消息部分顯示錯誤的圖像。 Here is the image 還爲額外的信息,我使用: 的Android 2.2.3工作室與 SDK API級別23和 構建工具25.0.2

+0

請閱讀(HTTPS [在什麼情況下我想補充「緊急」或其他類似的短語我的問題,爲了獲得更快的答案?]:/ /meta.stackoverflow.com/q/326569) - 總結是,這不是處理志願者的理想方式,而且可能適得其反。愛寧的答案。請不要將這添加到您的問題。 – halfer

回答

0

在你build.gradle [應用級]導入所有這些庫,其中的在錯誤列表中列出,並更新Android工作室 -

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' 
    } 
+0

試過了。不起作用 –

相關問題