Dex文件中的'字符串数'是什么意思? [英] What does 'String count' mean in Dex file Android?

查看:385
本文介绍了Dex文件中的'字符串数'是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 adt-21-preview DOC


建设

Building

有一个新标志强制dex的jumbo模式允许 dex文件中包含更多字符串;在project.properties中设置dex.force.jumbo = true

There's a new flag to force "jumbo mode" for dex which allows a larger number of strings in the dex files; set dex.force.jumbo=true in project.properties

我红了这个什么-是最DEX-方法和 - 串限制式-AN- android-app
,其中 @SamWise 答案:

I red this what-are-the-dex-method-and-string-limits-in-an-android-app too, where @SamWise answers:


使用jumbo dex时,字符串参考限制介于110K和120K之间。

With jumbo dex on, the string reference limit is somewhere between 110K and 120K.

问题:

Dex中的 String 字符串引用是什么?他们的意思是变长吗?例如,如果我写的话:

What is String or String reference in Dex? Do they mean variable length? For example if I'll write:

private String foo = "fessy";

这意味着 string 是3或值长度,在我的情况下5 ?

Doe it mean string is 3 or value length, in my case 5?

子问题:

我使用以下脚本 dex-method-counts 来计算方法计数但是我没有找到任何计算 String 计数的参考。

I used following script dex-method-counts to calculate method Count but I didn't find any reference to calculate String count.

请帮忙,

推荐答案

所有字符串常量都存储在dex文件在单个排序列表中。然后通过该列表中的索引在dex文件的其他地方引用字符串。

All strings constants are stored in a dex file in a single sorted list. The strings are then referenced elsewhere in the dex file by index within that list.

这些字符串索引通常是无符号的32位整数。就实际指令而言,有2条指令可以引用字符串: const-string const-string / jumbo 。第一个采用16位字符串索引,第二个采用32位字符串索引。

These string indexes are generally an unsigned 32-bit integer. As far as the actual instructions go, there are 2 instructions that can reference a string: const-string and const-string/jumbo. The first takes a 16-bit string index, and the second takes a 32-bit string index.

因此,最大字符串数为2 ^ 32 = 4294967296

So, the maximum number of strings is 2^32 = 4294967296

这篇关于Dex文件中的'字符串数'是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆