美文网首页
android 统计项目方法数

android 统计项目方法数

作者: 木木禾木 | 来源:发表于2019-11-12 17:24 被阅读0次

随着项目代码量的增大,有时会遇到方法数限制,如:
The number of method references in a .dex file cannot exceed 64K

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]
这时,就像知道项目到底有多少个方法~

那项目的方法数怎么统计呢?
  1. 在项目(project)级的 build.gradle 中添加 dexcount-gradle-plugin:0.6.4
buildscript {
    repositories {
        //***
    }
    dependencies {
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4'
    }
}
  1. 在app(module)的 build.gradle中添加 apply plugin: 'com.getkeepsafe.dexcount' :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.getkeepsafe.dexcount'
  1. 编译运行项目,即可看到方法数统计信息。


    方法数统计

over~

相关文章

网友评论

      本文标题:android 统计项目方法数

      本文链接:https://www.haomeiwen.com/subject/gbuqictx.html