Gradle项目同步已完成但有一些错误(无法同步)

时间:2016-10-04 14:56:11

标签: android compilation dependencies repository android-gradle

我的build.gradle出错了。我尝试链接到Github项目但它失败了。

的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'
}

我尝试按照本网站上的说明进行操作:

有人可以帮我解决问题吗?

1 个答案:

答案 0 :(得分:0)

我今天遇到了同样的错误。为了解决这个问题,我打开了 build.gradle 文件并替换了 2 出现的:

repositories {
    jcenter()
}

通过

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

在我的情况下,问题是由代理引起的。它有 https 的问题,然后我强迫使用 http