我一直收到此错误(Gradle项目同步失败。基本功能无法正常运行)

时间:2018-11-07 10:15:44

标签: java android gradle

我一直收到这个Gradle错误,尽管我确实更新了每个Gradle配置密钥,并且我仔细检查了每一行。我还是不明白是什么问题?

  

Gradle项目同步失败。基本功能(例如,编辑,调试)   将无法正常工作

它告诉我查看错误信息的查看窗口以及其中的信息:

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
:wrapper UP-TO-DATE

BUILD SUCCESSFUL in 0s
1 actionable task: 1 up-to-date
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

CONFIGURE SUCCESSFUL in 0s

成绩

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26

    dexOptions {
        javaMaxHeapSize "4g"
    }


    lintOptions {
        quiet true
        abortOnError false
        ignoreWarnings true
    }
    configurations {
        all*.exclude group: 'commons-io'

    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'BinaryEncoder.java'
    }

    defaultConfig {
        applicationId 'com.xxx.xxx'
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 3
        versionName '1.2'
         multiDexEnabled true
        ndk {
        abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'mips'
         }
        resConfigs 'en'

    }
    sourceSets {
        main {
            java {
                exclude 'com.twilio:client-android:1.2.18.org.apache.http.lejacy.jar.org.apache.BinaryEncoder.java'
                exclude 'org.apache.commons.codec.BinaryEncoder.java'
            }
        }
        androidTest {
            java {
                exclude 'commons-codec-1.10/**'
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}


dependencies {
    configurations { all*.exclude group: 'com.android.support', module: 'support-v13' }
    implementation fileTree(include: '*.jar', dir: 'libs')
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation('com.github.hotchemi:permissionsdispatcher:2.4.0') { exclude module: 'support-v13'}
    implementation 'com.stripe:stripe-android:7.0.1'
    implementation 'com.braintreepayments.api:braintree:2.7.0'
    implementation 'com.braintreepayments.api:drop-in:3.1.0'
    implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
    implementation 'com.github.markomilos:paginate:0.5.1'
    implementation 'com.github.czy1121:segmentedview:1.0.0'
    implementation 'com.orhanobut:logger:2.2.0'
    implementation 'com.twilio:client-android:1.2.18'
    implementation 'com.squareup.okio:okio:1.11.0'
    implementation 'com.squareup.retrofit2:retrofit:2.2.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
    implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
    implementation 'com.google.android.gms:play-services-gcm:11.4.0'
    implementation 'com.google.android.gms:play-services-identity:11.4.0'
    implementation 'com.google.android.gms:play-services-plus:11.4.0'
    implementation 'com.google.android.gms:play-services-maps:11.4.0'
    implementation 'lib.kingja.switchbutton:switchbutton:1.1.3'
    implementation 'com.orhanobut:hawk:2.0.1'
    implementation 'com.afollestad:material-camera:0.4.4'
    implementation 'com.werb.pickphotoview:pickphotoview:0.3.0'
    implementation 'com.github.Kennyc1012:BottomSheet:2.3.4'
    implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
    implementation 'com.android.support:design:26.0.1'
    implementation 'com.android.support:cardview-v7:26.0.1'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'
    implementation 'de.greenrobot:eventbus:2.4.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.14.4'
    implementation 'com.koushikdutta.ion:ion:2.1.8'
    implementation 'com.afollestad.material-dialogs:core:0.8.6.0'
    implementation 'com.amitshekhar.android:android-networking:1.0.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.android.support:support-v4:26.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-messaging:11.4.0'
    implementation 'com.google.firebase:firebase-core:11.4.0'
    testImplementation 'junit:junit:4.12'
    annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
}
apply plugin: 'com.google.gms.google-services'

更新

这是porject gradle文件

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
        maven { url 'https://jitpack.io' }

        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }

}

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

2 个答案:

答案 0 :(得分:0)

您可以使用以下命令来识别compile个配置依存关系:

./gradlew app:dependencies --configuration compile

答案 1 :(得分:0)

我注意到Android Studio建议了一个操作Remove minSdkVersion and sync project,然后单击它并进行了修复。但是它并没有从模块的build.grdale文件中删除该行,我不是他的意思是什么,但是无论如何它都已修复。如果有人知道更多信息,请告诉。