Android的工作室出口字符串从支持库APK [英] Android Studio exports strings from support library to APK

查看:235
本文介绍了Android的工作室出口字符串从支持库APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我切换从Eclipse来Android的工作室。我有多个模块依赖关系的项目。一个依赖是支持库appcompat,包括像这样的:

Recently i switched from Eclipse to Android Studio. I have a project with multiple module dependencies. One dependency is the support library appcompat, included like this:

dependencies {
    compile "com.android.support:appcompat-v7:19+"
}

在Android的文档我发现这个库需要与资源,这似乎工作确定进口。我用在我的项目库中没有任何问题。

In the Android docs i found out that this library needs to be imported with resources, which seem to work OK. I use the library in my project without problems.

现在的问题是,当我建立一个APK和运行AAPT的outpus说:

The problem is, when i build an APK and run aapt, the outpus says:

locales: '--_--' 'de' 'nl' 'pl' 'sl' 'fr' 'cs' 'es' 'it' 'ca' 'da' 'fa' 'ja' 'nb' 'af' 
'bg' 'th' 'fi' 'hi' 'vi' 'sk' 'uk' 'el' 'tl' 'am' 'in' 'ko' 'ro' 'ar' 'hr' 'sr' 'tr' 
'lt' 'pt' 'hu' 'ru' 'zu' 'lv' 'sv' 'iw' 'sw' 'fr_CA' 'lo_LA' 'en_GB' 'et_EE' 'ka_GE' 
'km_KH' 'zh_HK' 'hy_AM' 'zh_CN' 'en_IN' 'mn_MN' 'es_US' 'pt_PT' 'zh_TW' 'ms_MY'

但是,这是不正确的,我的应用程序仅支持第8条所列语言。当我uplod这个APK播放,它显示了我所做的更改previous版本(构建与Eclipse),和它说,我已经添加了47 languges,但同样,这是不正确的。 从截图游戏devconsole:

But this is not true, my app supports only the first 8 listed languages. When i uplod this apk to Play, it's showing me the changes to the previous version(build with eclipse), and it says that i have added 47 languges, but again, this is not true. Screenshot from Play devconsole:

我发现谷歌code 这类似的问题,但没有任何反应,我想解决这个问题可以尽快,因为我要上传我的新APK播放。

I found this similar issue on Google code, but there is no response, i wish to solve this ASAP because i have to upload my new APK to Play.

不知道如何摆脱这些47其他语言,而库必须保持进口的资源,才能正常工作?

Any idea how to get rid of these 47 other languages, while the library must stay imported with resources, to work properly?

更新:谷歌code 他们说,这有望为现在和他们在寻找增加的方式来选择你想要什么的APK包含。

UPDATE: On Google code they say that this is expected for now and they were looking to add a way to select what you want to include in the apk.

推荐答案

code.google.com 他们说,摇篮插件有一个选项,以限制资源,因为0.7.0版本发布。

At code.google.com they say that the gradle plugin has a option to restrict resources, since version 0.7.0 is released.

请注意在版本0.7.0发行说明

对产品风味(和defaultConfig)允许过滤新选项   通过AAPT的-c选项资源

New option on product Flavor (and defaultConfig) allow filtering of resources through the -c option of aapt

      
  • 您可以通过单一值(resConfig)或通过DSL多个值(resConfigs)。
  •   
  • 从默认的配置所有的价值和风味得到结合,并传递给AAPT。
  •   
  • 见<一href="https://doc-0s-2o-docsviewer.googleusercontent.com/viewer/securedownload/si4ejtakoti45b1r272cvrccjsuip8dh/mn85h5vm2dpadseou07m7rmv67g3dlqg/1389259800000/c2l0ZXM=/AGZ5hq94ab9iBQiwgEnrhrf6M49V/WVc1a2NtOXBaQzVqYjIxOGRHOXZiSE44WjNnNk5EWXpOVFZqTWpObU0yWXdNamhoTkE=?sec=AHSqidafjksps-XulB02lLwy7ScELxlyW1tlQZL0j2cCW22mQYGYF_BlQZ6bgXFOr3oz9N3hTGSm&a=dl&filename=gradle-samples-0.7.3.zip&rel=zip;z437;build.gradle&nonce=56sl87codf3cq&user=AGZ5hq94ab9iBQiwgEnrhrf6M49V&hash=9jthqhqc9emv16tnb4odj0fg3uc3eb7p">"basic"样品。
  •   
  • You can pass single value (resConfig) or multiple values (resConfigs) through the DSL.
  • All values from the default config and flavors get combined and passed to aapt.
  • See "basic" sample.

下面是一些示例code就摆在你的项目的build.gradle文件:

Here is some sample code to put in the build.gradle file of your project:

android {
    defaultConfig {
        resConfigs "en", "de", "es" //Define languages that your app supports.
    }
}

我花了很多时间去寻找基本样本......可能是在发行说明的链接:/所以有链接:

I spent a lot of time to find the "Basic sample"...could be a link in the release notes :/ so there are the links:

  • <一个href="https://docs.google.com/viewer?a=v&pid=sites&srcid=YW5kcm9pZC5jb218dG9vbHN8Z3g6NDYzNTVjMjNmM2YwMjhhNA">Gradle样品
  • <一个href="https://doc-0s-2o-docsviewer.googleusercontent.com/viewer/securedownload/si4ejtakoti45b1r272cvrccjsuip8dh/mn85h5vm2dpadseou07m7rmv67g3dlqg/1389259800000/c2l0ZXM=/AGZ5hq94ab9iBQiwgEnrhrf6M49V/WVc1a2NtOXBaQzVqYjIxOGRHOXZiSE44WjNnNk5EWXpOVFZqTWpObU0yWXdNamhoTkE=?sec=AHSqidafjksps-XulB02lLwy7ScELxlyW1tlQZL0j2cCW22mQYGYF_BlQZ6bgXFOr3oz9N3hTGSm&a=dl&filename=gradle-samples-0.7.3.zip&rel=zip;z437;build.gradle&nonce=56sl87codf3cq&user=AGZ5hq94ab9iBQiwgEnrhrf6M49V&hash=9jthqhqc9emv16tnb4odj0fg3uc3eb7p">Basic品尝
  • 发行说明
  • Gradle samples
  • Basic sample
  • Release notes

请注意: 版本0.7.x要求Android的工作室0.4 +(目前仅在加那利道可用)和摇篮1.9。

NOTE: Version 0.7.x requires Android Studio 0.4.+(currently available only in Canary channel) and Gradle 1.9.

这篇关于Android的工作室出口字符串从支持库APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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