question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find method dexcount() for arguments

See original GitHub issue

When I add dexcount {…} to my app gradle, I get this error:

Error:org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method dexcount() for arguments [build_co6u1j4pjvt1t3moujul16v4c$_run_closure1@22294fa4] on project ':app' of type org.gradle.api.Project.

If I remove the dexcount block then I can build and run the app just fine (it just doesn’t give any dex counts in the output folder).

app gradle file is:

buildscript {
    repositories {
        mavenCentral() // or jcenter()
    }

    dependencies {
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.2'
    }
}

// make sure this line comes *after* you apply the Android plugin

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'com.getkeepsafe.dexcount'

//apply plugin: 'kotlin-kapt'
dexcount {
    format = "list"
    includeClasses = false
    includeClassCount = false
    includeFieldCount = true
    includeTotalMethodCount = false
    orderByMethodCount = false
    verbose = false
    maxTreeDepth = Integer.MAX_VALUE
    teamCityIntegration = false
    teamCitySlug = null
    runOnEachPackage = true
    maxMethodCount = 64000
}

android {
    signingConfigs {
        config {
           ...
        }
    }
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            versionNameSuffix "-debug"
        }
    }
    flavorDimensions "mode"
    productFlavors {
        free {
            dimension "mode"
        }
        pro {
            dimension "mode"
            applicationIdSuffix ".pro"
        }
    }
}


dependencies {
   ...
}

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


Thanks in advance for any guidance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
benjamin-badercommented, Jul 14, 2017

Great, thank you - I’ll have a fix shortly. Appreciate your help!

1reaction
benjamin-badercommented, Jul 14, 2017

OK - would you please turn it off, put the dexcount config block back into your gradle file, then build? If the build succeeds, then I’ll be confident that I know the bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find method apply() for arguments [com.google.gms ...
The problem is that you wrote apply 'com.google.gms.google-services'. instead of apply plugin: 'com.google.gms.google-services'.
Read more >
Fix "Error Could not find method implementation() for ...
The main reason for “Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]”” error is that the Gradle ...
Read more >
Enable multidex for apps with over 64K methods
Learn how to enable an app configuration known as multidex, which allows your app to build and read multiple DEX files.
Read more >
Dexcount Gradle Plugin
A Gradle plugin to report the number of method references in your APK, AAR, or java module on every build. This helps you...
Read more >
Bad Error message with outdated Gradle Wrapper [182439309]
Could not find method dependencyResolutionManagement() for arguments [...] Compare: the error message after fiddling with the Wrapper and trying to build ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found