2016-10-04 75 views
1

我的build.gradle出現錯誤。我嘗試鏈接到Github項目,但失敗了。Gradle項目同步完成時出現一些錯誤(無法同步)

的build.gradle(項目:XXXX)

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
      //mavenCentral() 
     maven { url "https://maven/jjhesk" } 
     jcenter() 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
      mavenCentral() 
     maven { url "https://maven/jjhesk" } 
     jcenter() 

    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

的build.gradle(模塊:XXXX)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.google.testingtimer" 
     minSdkVersion 16 
     targetSdkVersion 24 
     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(include: ['*.jar'], dir: 'libs') 
     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:24.2.1' 
    compile 'com.github.pheynix:TimerView:660400fb64' 
    //androidTestCompile 'junit:junit:4.12' 
} 

我儘量遵循這些說明這是在這個網站:

有人可以幫我解決問題嗎?

+0

你得到的錯誤信息是什麼? – sanastasiadis

+0

@sanastasiadis錯誤(1,0)無法獲取根項目的未知屬性'build' – Jane

+0

問題:你有'build.gradle(Project:XXXX)'作爲你的根項目的build.gradle的第一行嗎?你不應該。 – sanastasiadis

回答

0

今天我有同樣的錯誤。爲了解決這個問題,我打開的build.gradle文件和替換的 OCCURENCES:

repositories { 
    jcenter() 
} 

通過

repositories { 
    maven { url "http://jcenter.bintray.com" } 
    jcenter() 
} 

在我的情況下,問題是由代理引起的。它有問題https然後我強迫使用http