首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Gradle dexcount-gradle-plugin

Android Gradle dexcount-gradle-plugin
EN

Stack Overflow用户
提问于 2016-04-17 19:53:40
回答 2查看 2.8K关注 0票数 0

我读了文档,但我不能去。我使用的是Android Studio 2.0稳定版本。

这是我的项目级build.gradle文件:

代码语言:javascript
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

这是应用模块级的build.gradle文件:

代码语言:javascript
复制
    buildscript {
    repositories {
        mavenCentral() // or jcenter()
    }

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

apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'

dexcount {
    format = "list"
    includeClasses = false
    includeFieldCount = true
    includeTotalMethodCount = false
    orderByMethodCount = false
    verbose = false
    maxTreeDepth = Integer.MAX_VALUE
    teamCityIntegration = false
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "my_package_name"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0.0"
    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            debuggable false
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions{
        exclude 'META-INF/maven/commons-io/commons-io/pom.xml'
        exclude 'META-INF/maven/commons-io/commons-io/pom.properties'
    }
}

ext {
    supportLibVersion = '23.3.0'
    googlePlayServicesVersion = '8.4.0'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
    compile "com.android.support:percent:${supportLibVersion}"
    compile "com.android.support:cardview-v7:${supportLibVersion}"

    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'

    // eventbus
    compile 'org.greenrobot:eventbus:3.0.0'

    // rate me dialog
    compile 'com.github.hotchemi:android-rate:0.5.6'

    // apache commons-io
    compile group: 'commons-io', name: 'commons-io', version: '2.0.1'
}

这是每次都会产生错误:

代码语言:javascript
复制
Error:(11, 0) Dexcount plugin requires the Android plugin to be configured

这个错误的解决方案是什么?

EN

回答 2

Stack Overflow用户

发布于 2016-07-12 06:05:42

解决方案

我换了一条线

“应用插件:'com.android.application'”

使用

“应用插件:'com.getkeepsafe.dexcount'”

而且它起作用了

票数 4
EN

Stack Overflow用户

发布于 2016-08-15 17:55:44

它在Dex count's GitHub repo中进行了记录

代码语言:javascript
复制
// make sure this line comes *after* you apply the Android plugin
apply plugin: 'com.getkeepsafe.dexcount'

所以就像你说的,只要确保Android插件在Dex count插件之前。

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36676135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档