如果我没有达到 64k 限制,为什么我需要启用 multidex?

Why do I need enable multidex if I do not reach 64k limitation?

我读到过有关方法限制 64k 和 Multi-dex 标志的问题。 设置 Multi-dex,对我有用! 但是我用 https://github.com/google/android-classyshark 检查我的应用程序,它说我的应用程序有 methods-count: 30925

那么我怎么可能 "java.exe" 退出并出现代码 2 错误?有什么想法吗?

来自doc

When your app and the libraries it references exceed 65,536 methods, you encounter a build error that indicates your app has reached the limit of the Android build architecture

我在某处读到,

A​​pp Compat 包含约 16k 个方法
Google Play 服务 GCM 包含约 17k 个方法

在这里,您可能正在使用可能正在使用其他库的库。因此,您可能想尝试使用其他工具来检查实际的方法计数。