【问题标题】:Android - How to extract resources from apk FOR ONE SPECIFIC LOCALE/LANGUAGEAndroid - 如何为一种特定的语言环境/语言从 apk 中提取资源
【发布时间】:2016-03-07 11:35:08
【问题描述】:

编辑:

在下面查看我的答案:apktool 完成了这项工作。


编辑:

来自 Hanno Binder 的评论:

"显然,-c 选项仅在 p[ackaging] 资源时有效,而不是在提取资源时有效。"


我尝试使用“aapt”工具从 apk 中提取 fr 字符串。

我能够像这样获得所有资源:

.\android-sdks\build-tools\23.0.2\aapt.exe d --values resources my.apk > resources.all.txt

我只想获取给定语言环境的资源,例如 fr(法语)。关于这一点,aapt 文档指出:

   -c  specify which configurations to include.  The default is all
       configurations.  The value of the parameter should be a comma
       separated list of configuration values.  Locales should be specified
       as either a language or language-region pair.  Some examples:
            en
            port,en
            port,land,en_US

所以我尝试了

.\android-sdks\build-tools\23.0.2\aapt.exe d -c fr --values resources my.apk > resources.fr。 txt

但输出仍包含 all 配置 (/locales) 的字符串。

问题:

我该怎么办?

注意:

我很确定 apk 确实包含 fr 数据,因为我使用以下方式获取 apk 配置:

.\android-sdks\build-tools\23.0.2\aapt.exe d --values configurations my.apk >configurations.txt

并且 fr 在配置列表中。 (另外,我在资源中看到了一些 fr 字符串。all.txt)

【问题讨论】:

  • 显然-c选项只对p[ackaging]资源有效,对提取无效。
  • 感谢更新

标签: android internationalization resources apk


【解决方案1】:

实现此目的的一种方法是使用apktool

$ apktool d theApkYouWantToExtractResourcesOf.apk

这将生成一个 ./theApkYouWantToExtractResourcesOf/ 文件夹,其中包含所有资源,包括

./theApkYouWantToExtractResourcesOf/res/values-<language>/

我对法语字符串很感兴趣,在这里找到了它们:

./theApkYouWantToExtractResourcesOf/res/values-fr/strings.xml

任务完成!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-18
    • 2022-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-26
    相关资源
    最近更新 更多