You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android无法获取全部类的问题求助(基于DexFile实现)

问题:DexFile获取全量类名仍未满足需求

我尝试通过DexFile来获取应用中的所有类名,实现代码如下:

private List<String> getAllClasses() throws IOException { 
    ArrayList<String> classes= new ArrayList<String>(); 
    DexFile df = new DexFile(getPackageCodePath()); 
    for (Enumeration<String> iter = df.entries(); iter.hasMoreElements();) { 
        String s = iter.nextElement(); 
        classes.add(s); 
    } 
    return classes; 
}

关闭Instant Run之后,我能获取到更多类(总数达到4157个),甚至连外部依赖库中的类都能成功获取,但即便如此,还是没法满足我的需求,问题至今仍未解决。

内容的提问来源于stack exchange,提问作者AKS

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:36:07