androidgradlekotlinandroid-manifestandroid-buildconfig

Gradle build error (manifestOutputFile) when upgrading plugin to 3.0.0


After upgrading the Gradle plugin version to 3.0.0 (classpath "com.android.tools.build:gradle:3.0.0") and if I then try to clean or build the project I get this error:

A problem occurred configuring project ':app'.
> Manifest Tasks does not support the manifestOutputFile property any 
more, please use the manifestOutputDirectory instead.
  For more information, please check 
https://developer.android.com/studio/build/gradle-plugin-3-0-0-
migration.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output.

* Get more help at https://help.gradle.org

I am not using manifestOutputFile anywhere in any of my gradle files. using the --debug and --stacktrace flags did nothing for me. I'm guessing this issue is coming up in one of my dependencies but I have no idea. Also, I am using Kotlin in a lot of classes; I'm not sure if that matters or not. Does anyone know if there is a way to see which library is throwing this error? Or does anyone have any suggestions or insight around this issue when the build.gradle file does not even reference manifestOutputFile?

Here's most of the build.gradle file:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://maven.google.com'}
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.24.4'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
        classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
        classpath 'gradle.plugin.com.nobleworks_software.icon-overlay:icon-overlay-plugin:1.2.3'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'io.fabric'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
apply plugin: 'jacoco-android'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.nobleworks_software.icon-overlay'


repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    flatDir {
        dirs 'libs'
    }
}

ext {
    libsSrcDir = new File('${projectDir}/libs')
}

String gpsPropertyName = 'gps'
String gpsPropertyValueAlpha = 'alpha'
String gpsPropertyValueBeta = 'beta'
boolean tangoBuild = false
String tangoPropertyName = 'tango'
String alphaBuildEnding = '20'
String betaBuildEnding = '10'
String productionBuildEnding = '00'

def isBuildForGPS = { ->
    return project.hasProperty(gpsPropertyName)
}

def isTangoBuild = { ->
    return project.hasProperty(tangoPropertyName)
}

def getBranchName = { ->
    try {
        def branchOut = new ByteArrayOutputStream()

        exec {
            commandLine 'git', 'symbolic-ref', '--short', 'HEAD'
            standardOutput = branchOut
        }

        return branchOut.toString().trim()
    }
    catch (ignored) {
        return 'master'
    }
}

def getVersionCode = { ->
    try {
        def stdout = new ByteArrayOutputStream()

        exec {
            commandLine 'git', 'rev-list', '--count', 'HEAD'
            standardOutput = stdout
        }

        // Make the Tango version use '50' as the least sig offset
        int tangoOffset = 0
        if (tangoBuild) {
            tangoOffset = 50
        }
        if (isBuildForGPS()) {
            String channel = project.findProperty(gpsPropertyName)
            if (gpsPropertyValueAlpha == channel) {
                return Integer.parseInt(stdout.toString().trim() + alphaBuildEnding) + tangoOffset
            } else if (gpsPropertyValueBeta == channel) {
                return Integer.parseInt(stdout.toString().trim() + betaBuildEnding) + tangoOffset
            }
        }

        return Integer.parseInt(stdout.toString().trim() + productionBuildEnding) + tangoOffset
    }
    catch (ignored) {
        return -1
    }
}

def getVersionName = { ->
    try {
        if (isBuildForGPS()) {
            def tag = getLastTaggedVersion()

            String channel = project.findProperty(gpsPropertyName)
            if (gpsPropertyValueAlpha == channel) {
                tag = tag + '-a'
            } else if (gpsPropertyValueBeta == channel) {
                tag = tag + '-b'
            }

            return tag
        } else {
            return getBranchName()
        }
    }
    catch (ignored) {
        return 'X.X.X'
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    dataBinding {
        enabled = true
    }

    defaultConfig {
        versionCode getVersionCode()
        versionName getVersionName()
        applicationId getApplicationId()
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled = true
        multiDexKeepFile file('multidex_keep_file.txt')
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "com.demoapp.demoapp.WayTestRunner"
        renderscriptTargetApi 16
        renderscriptSupportModeEnabled true

        String branchName = getBranchName().toUpperCase()
        String iconOverlayText = branchName.toLowerCase()

        buildConfigField "String", "LAST_TAGGED_VERSION", "\"${getLastTaggedVersion()}\""

        if (branchName == 'DEV') {
            iconOverlayText = 'ALPHA'
        } else if (branchName.startsWith('RELEASE')) {
            iconOverlayText = 'BETA'
        }

        if (!isBuildForGPS()) {
            iconOverlay {
                enabled = true
                fontSize = 8
                textColor = [255, 255, 255, 255]
                verticalLinePadding = 2
                backgroundOverlayColor = [0, 0, 0, 180]
                text = { "$iconOverlayText" }
            }
        }

        configurations.all {
            resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
        }

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }

    flavorDimensions("store", "3d_enabled")
    productFlavors {
        demoapp {
            dimension = "store"
            applicationId getApplicationId()
            // Dupe required because SearchRecentSuggestionsProvider has no available context in its constructor
            buildConfigField "String", "SEARCH_RECENT_AUTHORITY", "\"${applicationId}.WFSearchRecentSuggestionsProvider\""
            // And one for the manifest
            resValue "string", "SEARCH_RECENT_AUTHORITY", "${applicationId}.WFSearchRecentSuggestionsProvider"

            // These need to be defined as string resources so they can be registered in the manifest.
            // However in order to access them in tests it's convenient to have them also defined in BuildConfig
            String deepLinkScheme = "demoappapp"
            resValue "string", "EXPLICIT_DEEP_LINK_SCHEME1", deepLinkScheme
            resValue "string", "EXPLICIT_DEEP_LINK_SCHEME2", deepLinkScheme
            buildConfigField "String", "EXPLICIT_DEEP_LINK_SCHEME1", "\"${deepLinkScheme}\""
            buildConfigField "String", "EXPLICIT_DEEP_LINK_SCHEME2", "\"${deepLinkScheme}\""

            if (getBranchName().toUpperCase() == 'MASTER') {
                manifestPlaceholders = [
                        appIcon     : "@mipmap/ic_launcher",
                        appRoundIcon: "@mipmap/ic_launcher_round"
                ]
            } else {
                manifestPlaceholders = [
                        appIcon     : "@mipmap/ic_launcher_dev",
                        appRoundIcon: "@mipmap/ic_launcher_dev_round"
                ]
            }
        }

        demoappflavor {
            dimension = "store"
            applicationId getDemoappflavorApplicationId()
            // Dupe required because SearchRecentSuggestionsProvider has no available context in its constructor
            buildConfigField "String", "SEARCH_RECENT_AUTHORITY", "\"${applicationId}.WFSearchRecentSuggestionsProvider\""
            // And one for the manifest
            resValue "string", "SEARCH_RECENT_AUTHORITY", "${applicationId}.WFSearchRecentSuggestionsProvider"

            // These need to be defined as string resources so they can be registered in the manifest.
            // However in order to access them in tests it's convenient to have them also defined in BuildConfig
            String deepLinkScheme1 = "theapp"
            String deepLinkScheme2 = "demoappflavorapp"
            resValue "string", "EXPLICIT_DEEP_LINK_SCHEME1", deepLinkScheme1
            resValue "string", "EXPLICIT_DEEP_LINK_SCHEME2", deepLinkScheme2
            buildConfigField "String", "EXPLICIT_DEEP_LINK_SCHEME1", "\"${deepLinkScheme1}\""
            buildConfigField "String", "EXPLICIT_DEEP_LINK_SCHEME2", "\"${deepLinkScheme2}\""

            manifestPlaceholders = [
                    appIcon     : "@mipmap/ic_launcher",
                    appRoundIcon: "@mipmap/ic_launcher_round"
            ]
        }
    }

    android.variantFilter { variant ->
        def store = variant.getFlavors().get(0).name
        def tango_enabled = variant.getFlavors().get(1).name

        // Disable building the tango dimension
        if ((store == 'demoappflavor' || !isTangoBuild()) && tango_enabled == "tangoEnabled") {
            variant.setIgnore(true)
        }
    }

    buildTypes {
        release {
            // Commented out to stop a production build crash with OKIO
            //minifyEnabled true
            // Commented out due to Gradle 2.2.0 issue
            //shrinkResources true
            ext.enableCrashlytics = true
            apply plugin: 'signing'
            signingConfig signingConfigs.release
            ext.betaDistributionReleaseNotesFilePath = './release-notes.txt'
            ext.betaDistributionGroupAliases = 'android-nightly'
            buildConfigField 'boolean', 'OVERRIDE_MIN_VERSION', isBuildForGPS() ? 'false' : 'true'
            buildConfigField 'boolean', 'ENABLE_APPSEE', isBuildForGPS() ? 'true' : 'false'
        }

        debug {
            // TODO: Uncomment this out to enable code coverage
//            testCoverageEnabled true
            buildConfigField 'boolean', 'OVERRIDE_MIN_VERSION', isBuildForGPS() ? 'false' : 'true'
            buildConfigField 'boolean', 'ENABLE_APPSEE', isBuildForGPS() ? 'true' : 'false'
        }

        configurations.all {
            resolutionStrategy {
                force 'com.google.code.findbugs:jsr305:1.3.9'
                force 'com.google.guava:guava:21.0'
                force "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
                force 'com.google.code.gson:gson:2.8.2'
            }
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'bin/AndroidManifest.xml'
        exclude 'bin/jarlist.cache'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'

        return 0
    }

    testOptions {
        // Disable animations for UI testing
        animationsDisabled = true
        unitTests.returnDefaultValues = true
        unitTests.all {
            jacoco {
                includeNoLocationClasses = true
            }
        }
    }

    sourceSets {
        androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
    }
}

configurations {
    demoappTangoEnabledCompile
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://clojars.org/repo/" }
    }
}

ext.daggerVersion = '2.11'
ext.playServicesVersion = '11.6.2'
ext.supportLibsVersion = '27.0.1'
ext.robolectricVersion = '3.3.2'
ext.frescoVersion = '1.5.0'
ext.leakCanaryVersion = '1.5.4'
ext.roomVersion ='1.0.0'
ext.butterKnifeVersion ='8.7.0'
ext.espressoVersion ='3.0.1'
ext.gsonVersion ='2.8.2'
ext.mockitoVersion ='2.9.0'
ext.dexmakerVersion ='1.2'
ext.icepickVersion ='3.2.0'
ext.multidexVersion ='1.0.2'

dependencies {
    // Compile Project
    compile(project(':models'))

    // Compile
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }
    // GOOGLE LIBS
    compile "com.android.support:design:${supportLibsVersion}"
    compile "com.android.support:recyclerview-v7:${supportLibsVersion}"
    compile "com.android.support:cardview-v7:${supportLibsVersion}"
    compile "com.android.support:support-v4:${supportLibsVersion}"
    compile "com.android.support:support-v13:${supportLibsVersion}"
    compile "com.android.support:percent:${supportLibsVersion}"
    compile "com.android.support:support-annotations:${supportLibsVersion}"
    compile "com.android.support:appcompat-v7:${supportLibsVersion}"
    compile "com.android.support:multidex:${multidexVersion}"
    compile "com.google.code.gson:gson:${gsonVersion}"

    // FIREBASE AND PLAY SERVICES
    compile "com.google.firebase:firebase-messaging:${playServicesVersion}"
    compile "com.google.firebase:firebase-appindexing:${playServicesVersion}"
    //noinspection GradleDependency
    compile "com.google.android.gms:play-services-analytics:${playServicesVersion}"
    //noinspection GradleDependency
    compile "com.google.android.gms:play-services-auth:${playServicesVersion}"
    //noinspection GradleDependency
    compile "com.google.android.gms:play-services-wallet:${playServicesVersion}"

    // FLOW LAYOUT FOR CHIPS
    compile 'org.apmem.tools:layouts:1.10@aar'
    // RxJava and related
    compile 'io.reactivex.rxjava2:rxjava:2.1.7'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile project(':FloatingSearchView')

    // RxJava support for Room
    compile 'android.arch.persistence.room:rxjava2:1.0.0'
// Testing support
    androidTestCompile 'android.arch.core:core-testing:1.1.0'
    // Dagger
    compile "com.google.dagger:dagger:${daggerVersion}"
    compile "com.google.dagger:dagger-android-support:${daggerVersion}"
    kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
    kapt "com.google.dagger:dagger-android-processor:${daggerVersion}"

    compile ("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}") {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }

    compile "com.jakewharton:butterknife:${butterKnifeVersion}"
    kapt "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
    compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
    compile 'com.appsee:appsee-android:2.3.4'

    compile 'commons-io:commons-io:2.5'

    compile "com.android.support.test:runner:1.0.1"

    // ESPRESSO
    androidTestCompile "com.android.support:support-v4:${supportLibsVersion}"
    androidTestCompile "com.android.support:support-annotations:${supportLibsVersion}"
    androidTestCompile "com.android.support:recyclerview-v7:${supportLibsVersion}"
    androidTestCompile "com.android.support:design:${supportLibsVersion}"
    androidTestCompile "com.android.support:recyclerview-v7:${supportLibsVersion}"
    androidTestCompile "com.android.support.test.espresso:espresso-core:${espressoVersion}"
    androidTestCompile "com.android.support.test.espresso:espresso-intents:${espressoVersion}"
    androidTestCompile "com.android.support.test.espresso:espresso-contrib:${espressoVersion}"
    androidTestCompile "com.android.support.test.espresso:espresso-web:${espressoVersion}"
    androidTestCompile "org.mockito:mockito-core:${mockitoVersion}"
    androidTestCompile "com.google.dexmaker:dexmaker:${dexmakerVersion}"
    androidTestCompile "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
    androidTestCompile "com.android.support:multidex:${multidexVersion}"
    androidTestCompile "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
    androidTestCompile "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
    androidTestCompile "com.google.code.gson:gson:${gsonVersion}"
    androidTestCompile('com.jakewharton.espresso:okhttp3-idling-resource:1.0.0') {
        //Using App Version Instead
        exclude group: 'com.squareup.okio', module: 'okio'
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }
    //WireMock
    androidTestCompile( project(":wiremock")) {
        //Using Android Version Instead
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'

        exclude group: 'org.ow2.asm', module: 'asm'

        //Using Android Version Instead
        exclude group: 'org.json', module: 'json'
        exclude group: 'com.google.guava', module: 'guava'
    }

    androidTestCompile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-core:${mockitoVersion}"
    testCompile 'org.hamcrest:hamcrest-library:1.3'
    testCompile "org.robolectric:robolectric:${robolectricVersion}"
    testCompile "org.robolectric:shadows-multidex:${robolectricVersion}"
    testCompile "org.robolectric:shadows-support-v4:${robolectricVersion}"
    testCompile "com.google.code.gson:gson:${gsonVersion}"
    testCompile "com.google.dagger:dagger:${daggerVersion}"
    testCompile "com.android.support:multidex:${multidexVersion}"
    kaptTest "com.google.dagger:dagger-compiler:${daggerVersion}"
    // Kotlin mockito
    testCompile ("com.nhaarman:mockito-kotlin-kt1.1:1.5.0"){
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-reflect'
    }

    compile "frankiesardo:icepick:${icepickVersion}"
    provided "frankiesardo:icepick-processor:${icepickVersion}"

    compile "com.facebook.fresco:fresco:${frescoVersion}"
    compile "com.facebook.fresco:animated-gif:${frescoVersion}"
    // Canary
    debugCompile "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}"
    releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}"
    androidTestCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}"
    testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}"
    compile 'com.prolificinteractive:material-calendarview:1.4.3'

    //Card IO
    compile 'io.card:android-sdk:5.5.1'
    compile 'com.facebook.rebound:rebound:0.3.8'

    //Chrome Web-View
    compile "com.android.support:customtabs:${supportLibsVersion}"
    def folder = new File('./brickkit-android/BrickKit/bricks/build.gradle')
    if (folder.exists()) {
        compile project(':bricks')
    } else {
        compile 'com.demoapp:brickkit-android:0.9.27'
    }

    // intellij annotations are included in kotlin, so this creates
    // a "java.util.zip.ZipException: duplicate entry" on its modules
    //compile 'com.intellij:annotations:12.0@jar'

    testCompile "com.google.dagger:dagger:${daggerVersion}"

    demoappTangoEnabledCompile project(':demoappView')
    compile ('com.perimeterx.sdk:msdk:1.1.0') {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    }

    // Kotlin support
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

    //Data binding
    kapt "com.android.databinding:compiler:$gradleVersion"
    compile 'nl.littlerobots.rxlint:rxlint:1.4'

    // Room
    compile "android.arch.persistence.room:runtime:${roomVersion}"
    kapt "android.arch.persistence.room:compiler:${roomVersion}"
    androidTestCompile "android.arch.persistence.room:testing:${roomVersion}"


    // Stetho
    compile 'com.facebook.stetho:stetho:1.5.0'
    compile 'com.facebook.stetho:stetho-js-rhino:1.4.2'

    compile 'com.siftscience:sift-android:0.9.10'
}

import groovy.json.JsonBuilder
task uploadapithingFiles << {
    // Get all the apithing files
    String apithingDir = "${project.rootDir}/models/src/main/java/com/demoapp/models/requests/apithing-files"
    FileTree files = fileTree(dir: apithingDir)

    // TreeMap of File names and File Data
    TreeMap<String, String> fileMap = new TreeMap<>()
    files.each { file ->
        Scanner input = new Scanner(file)
        String output = ""
        while (input.hasNext()) {
            output = output + input.nextLine()
        }
        input.close()
        fileMap.put(file.name.take(file.name.lastIndexOf('.')), output)
    }

    // Build request JSON
    def json = new JsonBuilder()
    json{
        payload {
            build_id getVersionCode()
            client_id 2
            version lastTaggedVersion
            is_production isBuildForGPS() ? 1 : 0
            queries fileMap.collect {
                [
                        "name": it.key,
                        "query": it.value
                ]
            }
        }
    }

    // Create POST Request
    def url = 'http://services.demoapp.com:8280/purest/performance/app_apithing'
    def post = new URL(url).openConnection()
    def message = json.toString()

    projects.logger.debug(message)

    post.setRequestMethod("POST")
    post.setRequestProperty("Content-Type", "application/json; charset=utf-8")
    post.setDoOutput(true)
    post.getOutputStream().write(message.getBytes("UTF-8"))

    def responseCode = post.getResponseCode()
    if(responseCode >= 200 && responseCode <= 299) {
        projects.logger.lifecycle("apithing upload successful.")
    } else {
        projects.logger.lifecycle("apithing Upload Failed with response: ${post.getResponseMessage()}")
        throw new GradleException("ERROR: Unable to upload apithing files. Server returned a response code: ${responseCode}")
    }
}

project.gradle.taskGraph.whenReady {
    ->
    project.tasks.findAll { it.name =~ /connected.+AndroidTest/ }.each {
        it.ignoreFailures = true
    }
}

def errorOutput(dir) {
    println "\n\n================OUTPUT REPORT=================\n\n"
    println "The file $dir does not exist\n "
    println "Check the current APK Path and Version "
    println "\n\n==============================================\n\n"
}

def executeUpload(dir, isUpload, key) {
    if (isUpload) {
        exec {
            commandLine 'curl', 'https://tok_gh6e7yrydkhgqyaz2fvx702y8m@api.appetize.io/v1/apps', '-F', "file=@$dir", '-F', 'platform=android'
        }
    } else {
        exec {
            commandLine 'curl', "https://tok_gh6e7yrydkhgqyaz2fvx702y8m@api.appetize.io/v1/apps/$key", '-F', "file=@$dir", '-F', 'platform=android'
        }
    }
}

apply plugin: 'com.google.gms.google-services'

jacocoAndroidUnitTestReport {
    excludes += ['**/R.class','**/R$*.class','**/*$ViewInjector*.*','**/*$ViewBinder*.*','**/BuildConfig.*','**/Manifest*.*','**/*$Lambda$*.*','**/*Module.*','**/*Dagger*.*','**/*MembersInjector*.*','**/*_Provide*Factory*.*','**/*_Factory*.*','**/*$*$*.*','**/test*/**','**/androidTest/**','**/databinding/**']
}

tasks.whenTaskAdded { task ->
    if (task.name == 'connecteddemoappDebugAndroidTest' || task.name == 'connecteddemoappflavorDebugAndroidTest') {
        task.doFirst() {
            exec {

                commandLine 'sh', 'get_android_wiremock.sh'
            }
        }

        task.doLast() {
            exec {
                commandLine 'sh', 'get_device_recordings.sh', 'wiremock_blacklist.txt'
            }
        }
    }
}

android.applicationVariants.all { variant ->
    task("checkstyle${variant.name.capitalize()}", type: Checkstyle) {
        configFile file("${project.rootDir}/config/quality/checkstyle/checkstyle.xml")
        configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
        source 'src'
        include '**/*.java'
        exclude '**/gen/**'
        exclude '**/models/generated/**'
        classpath = files() as FileCollection
        group = "verification"
    }
    check.dependsOn("checkstyle${variant.name.capitalize()}")
}

android.applicationVariants.all { variant ->
    task("findbugs${variant.name.capitalize()}", type: FindBugs) {
        ignoreFailures = false
        effort = "default"
        reportLevel = "medium"
        excludeFilter = new File("${project.rootDir}/config/quality/findbugs/findbugs-filter.xml")
        classes = files("${project.rootDir}/app/build/intermediates/classes")
        source = fileTree('src/main/java/')
        classpath = files()
        group = "verification"
        reports {
            xml.enabled = false
            html.enabled = true
            xml {
                destination "$project.buildDir/findbugs/findbugs-output.xml"
            }
            html {
                destination "$project.buildDir/findbugs/findbugs-output.html"
            }
        }

        dependsOn "compile${variant.name.capitalize()}JavaWithJavac"
    }
    check.dependsOn("findbugs${variant.name.capitalize()}")
}

android.applicationVariants.all { variant ->
    task("buildCheckTest${variant.name.capitalize()}", type: GradleBuild) {
        dependsOn "checkstyle${variant.name.capitalize()}"
        dependsOn "assemble${variant.name.capitalize()}"
        dependsOn "lint${variant.name.capitalize()}"
        dependsOn "findbugs${variant.name.capitalize()}"
        dependsOn "test${variant.name.capitalize()}UnitTest"
        dependsOn "jacocoTest${variant.name.capitalize()}UnitTestReport"
        mustRunAfter "clean"
    }
}

task buildReleaseTest(type: GradleBuild)

android.applicationVariants.all { variant ->
    if (variant.name.endsWith("Release")) {
        buildReleaseTest.dependsOn("buildCheckTest${variant.name.capitalize()}")
    }
}

android.applicationVariants.all {  v ->
    if (v.buildType.name == "release"){
        v.assemble.dependsOn("uploadapithingFiles")
    }
}

buildReleaseTest.mustRunAfter('clean')

task cleanBuildReleaseTest(type: GradleBuild)
cleanBuildReleaseTest.dependsOn('clean')
cleanBuildReleaseTest.dependsOn('buildReleaseTest')

Solution

  • Whoa, that's a lot of plugins. The error message comes because one of them depends on an API that was changed in 3.x (hence migration link). You'll need to update the corresponding plugin.

    Based on gradle dependencies run at step 3 below, my guess is gradle.plugin.com.nobleworks_software.icon-overlay:icon-overlay-plugin. It shows com.android.tools.build:gradle:2.2.3 -> 3.0.1 nested under.

    (gradlew buildEnvironment on your project may also give you a similar result if you add 3.0.1 Android Gradle Plugin to your build.gradle)

    --stacktrace should have also given you the exact location where com.android.build.gradle.tasks.ManifestProcessorTask#getManifestOutputFile was called from. If it doesn't you can still do below:


    This is a way I would answer this question if I had an mvce. You have too many plugins to set up everything manually from scratch. This method is also applicable to any Gradle buildscript weirdness in plugins.

    1. Close your project in AS/IDEA
      Note: if you have a buildSrc in your project that could also work, so there's no need to close and create another.
    2. Create another project (let's call it debugger) with build.gradle file as follows:

      • buildscript {}'s contents from your project (but no buildscript block!)

        repositories {
            jcenter()
            ...
        }
        dependencies {
            implementation ... // for each classpath ...
        }
        
      • add plugins { id 'java' } on root level

      • add implementation 'com.android.tools.build:gradle:3.0.1' inside dependencies
    3. Open this project in IDEA/Android Studio
      (this will download all the sources for those plugins)
    4. Run gradlew --no-daemon -Dorg.gradle.debug=true --debug --stacktrace from terminal
      (this will stop executing and wait,
      note: Listening for transport dt_socket at address: 5005)
    5. Go to "Run/Debug configurations" dialog in debugger project
      • Create a "Remote" configuration (green +) with parameters from Gradle's log:
        Remote run configuration
      • Close dialog with OK / Apply
    6. Jump to class/file com.android.build.gradle.tasks.ManifestProcessorTask inside gradle-core-3.0.1-sources.jar
    7. Put a breakpoint at line 128 in ManifestProcessorTask.getManifestOutputFile
    8. To be safe repeat above two steps for gradle-core-3.0.1.jar's decompiled code as well. (line number may differ)
    9. Run menu > Debug "Remote"
    10. Wait and celebrate when breakpoint hits and you see who calls the method in the Debug view's Stack frame listing.

    It looks overwhelming, but it's quite simple and fast after you did this once.