gradle sync导致:代码无效 - 缺少块结束

时间:2017-07-16 12:22:20

标签: android android-studio gradle

每次我同步gradle时都会给出:

错误:(1,0)无效代码 - 缺少块结尾

上次同步没有任何改变,所以我想也许这是android studio的bug。我还清理/重新启动项目,使缓存无效并重新启动android studio。

我的项目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.3.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

// Define versions in a single place
ext {

    // Sdk and tools
    minSdkVersion = 17
    targetSdkVersion = 25
    compileSdkVersion = 25
    buildToolsVersion = '25.0.2'

    // dependencies
    AAVersion = '4.1.0'
    ormliteVersion='5.0'
    supportLibraryVersion = '25.3.1'
    constraintLayoutVersion = '1.0.2'
    gsonVersion='2.7'
    retrofitVersion = '2.2.0'
    converterGsonVersion = '2.2.0'
    glideVersion='3.7.0'
    acraVersion='4.9.1'
//    imageZoomVersion='2.2.5'
//    libphonenumberVersion='8.4.3'
//    swipyVersion='1.2.3@aar'
//    circleIndicatorVersion = '1.2.2@aar'
//    materialDrawerVersion = '5.8.2@aar'
    afollestadDialog = '0.9.4.4'
//    circularRevealVersion='1.1.1@aar'
//    googleServices='10.2.1'
//    firebaseVersion = '10.2.1'

    // test
    junitVersion = '4.12'
    espressoVersion = '2.2.2'
    runnerVersion = '0.5'
    rulesVersion = '0.5'
}

我的应用程序gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion
    defaultConfig {
        applicationId "com.farazpardazan.hamrahcard"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode 1
        versionName "0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile project(':gallery')

    compile "com.j256.ormlite:ormlite-android:$ormliteVersion"
    compile "ch.acra:acra:$rootProject.acraVersion"
    compile "com.afollestad.material-dialogs:core:$rootProject.afollestadDialog"
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.android.support:cardview-v7:$supportLibraryVersion"
    compile "com.android.support:gridlayout-v7:$supportLibraryVersion"
    compile "com.android.support:design:$supportLibraryVersion"
    compile "com.android.support:support-annotations:$supportLibraryVersion"
//    compile "com.android.support:support-vector-drawable:$supportLibraryVersion"
//    compile "com.android.support:animated-vector-drawable:$supportLibraryVersion"
    compile "com.android.support.constraint:constraint-layout:$constraintLayoutVersion"

    compile "com.google.code.gson:gson:$gsonVersion"
    compile "com.github.bumptech.glide:glide:$glideVersion"
    compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
    compile "com.squareup.retrofit2:converter-gson:$converterGsonVersion"

    testCompile "junit:junit:$junitVersion"
    androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
}

0 个答案:

没有答案