Android Gradle奇怪的错误

时间:2017-11-21 10:41:00

标签: android android-studio gradle android-gradle build.gradle

当我尝试在Android Studio中构建项目时,我收到以下错误:

  

错误:任务执行失败':hunter:packageDebug'。

     

>不支持的清单版本:1。

当我清理项目然后我可以正常运行它,但是我需要在下次构建之前再次清理它。这真的令人不安。我认为Gradle和Adnroid版本会有所帮助,但它没有改变任何内容。

app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.1"
    defaultConfig {
        applicationId "com.gamekit.gkquiz"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 15
        versionName "1.2.4"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    signingConfigs {
        config {
            keyAlias 'gamekit-key'
            keyPassword kspass
            storePassword kspass
            storeFile file('../gamekit-release-key.jks')
        }
    }
    buildTypes {
        release {
            ext.betaDistributionReleaseNotesFilePath = "crashlytics_release_notes.txt"
            ext.betaDistributionGroupAliases = "android-testers"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
    sourceSets {
        String sharedTestDir = 'src/sharedTest/java'
        test {
            java.srcDir sharedTestDir
        }
        androidTest {
            java.srcDir sharedTestDir
        }
    }
    packagingOptions {
        pickFirst 'META-INF/*'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    implementation project(':common')

    kapt libs.activitystarter_kapt

    implementation libs.paper_parcel
    kapt libs.paper_parcel_kapt

    compile ('com.github.kwizzad:kwizzad-android:2.0.2') {
         exclude group:"com.android.support"
         exclude group:"com.google.android.gms"
    }

    androidTestImplementation(libs.espresso_core, {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
    testImplementation libs.junit
}

common build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.23.0'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.1'

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }
    lintOptions {
        abortOnError false
    }
}

kapt {
    generateStubs = true
}

dependencies {
    implementation fileTree(dir: 'lib', include: '*.jar')

    api libs.kotlin
    api libs.android_support
    api libs.retrofit
    api libs.rx
    api libs.glide
    implementation libs.facebook_ads

    api('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }

    api 'com.github.MarcinMoskala:KotlinAndroidViewBindings:0.10'

    api libs.preference_holder
    api libs.activitystarter

    api group: 'joda-time', name: 'joda-time', version: '2.9.9'
    api group: 'com.google.code.gson', name: 'gson', version: '2.8.2'

    implementation 'com.facebook.android:facebook-android-sdk:4.25.0'
    implementation 'com.vk:androidsdk:1.6.8'

    implementation 'com.google.firebase:firebase-ads:11.2.0'
    implementation 'com.google.firebase:firebase-auth:11.2.0'
    implementation 'com.google.android.gms:play-services-auth:11.2.0'

    api 'com.github.marcinmoskala:ArcSeekBar:0.34'

    implementation libs.multidex

    androidTestImplementation(libs.espresso_core, {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation libs.junit
}

Project build.gradle

buildscript {
    ext.kotlin_version = '1.2.0-rc-39'
    ext.retrofit_version = '2.3.0'
    ext.okhttp_version = '3.6.0'
    ext.android_version = '27.0.1'
    ext.activity_starter_version = '1.00'
    ext.preference_holder_version = '1.51'

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.2' }
        maven { url "https://kotlin.bintray.com/kotlinx" }
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'io.fabric.tools:gradle:1.23.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
        maven { url 'https://maven.fabric.io/public' }
        maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" }
    }
}

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

ext.libs = [
        minions             : 'com.github.marcinmoskala:minions:0.082',
        preference_holder   : ["com.marcinmoskala.PreferenceHolder:preferenceholder:$preference_holder_version",
                               "com.marcinmoskala.PreferenceHolder:preferenceholder-gson-serializer:$preference_holder_version",],
        kotlin              : "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
        android_support     : ["com.android.support:support-v4:$android_version",
                               "com.android.support:appcompat-v7:$android_version",
                               "com.android.support:cardview-v7:$android_version",
                               "com.android.support:recyclerview-v7:$android_version",
                               "com.android.support:design:$android_version"],
        retrofit            : ["com.squareup.retrofit2:retrofit:$retrofit_version",
                               "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version",
                               "com.squareup.retrofit2:converter-gson:$retrofit_version",
                               "com.squareup.retrofit2:converter-scalars:$retrofit_version",
                               "com.squareup.okhttp3:okhttp:$okhttp_version",
                               "com.squareup.okhttp3:logging-interceptor:$okhttp_version"],
        facebook_ads        : 'com.facebook.android:audience-network-sdk:4.22.1',
        rx                  : ['io.reactivex.rxjava2:rxjava:2.0.9',
                               'io.reactivex.rxjava2:rxandroid:2.0.1'],
        activitystarter     : ["com.marcinmoskala.activitystarter:activitystarter:$activity_starter_version",
                               "com.marcinmoskala.activitystarter:activitystarter-kotlin:$activity_starter_version"],
        activitystarter_kapt: "com.marcinmoskala.activitystarter:activitystarter-compiler:$activity_starter_version",
        joda_time           : ['joda-time:joda-time:2.9.3',
                               'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.2.0'],
        event_bus           : 'de.greenrobot:eventbus:2.4.0',
        crashlytics         : 'com.crashlytics.sdk.android:crashlytics:2.5.0@aar',
        material_dialog     : 'com.afollestad.material-dialogs:core:0.9.0.1',
        glide               : 'com.github.bumptech.glide:glide:3.7.0',
        paper_parcel        : ['com.github.grandstaish.paperparcel:paperparcel:1.0.0',
                               'com.github.grandstaish.paperparcel:paperparcel-kotlin:1.0.0'],
        paper_parcel_kapt   : 'com.github.grandstaish.paperparcel:compiler:1.0.0',
        multidex            : 'com.android.support:multidex:1.0.2',
        junit               : 'junit:junit:4.12',
        espresso_core       : 'com.android.support.test.espresso:espresso-core:2.2.2',
        mockito             : 'org.mockito:mockito-core:1.10.19'
]

1 个答案:

答案 0 :(得分:0)

你有没有试过降级gradle,即改变

'com.android.tools.build:gradle:3.1.0-alpha04'

'com.android.tools.build:gradle:3.0.0'