Facebook app id 导致无法打包

好久没写了,今天遇到了这个问题,虽然可能国内的朋友可能很少遇上,但还是随心的记录一下,毕竟搞了两小时,就两行代码而已。


直接到主题:应用要使用facebook 登录,根据官方文档一步一步来,一切都很顺利,当到最后要打包的时候,却遇到了无法打包的问题。


Errors before ignored:
.../src/main/AndroidManifest.xml:109: Error: Resources referenced from the manifest cannot vary by configuration (except for version qualifiers, e.g. -v21.) Found variation in zh-rTW [ManifestResource]
            android:value="@string/facebook_app_id"/>
                           ~~~~~~~~~~~~~~~~~~~~~~~
.../src/main/res/values-zh-rTW/strings.xml:151: This value will not be used

   Explanation for issues of type "ManifestResource":
   Elements in the manifest can reference resources, but those resources
   cannot vary across configurations (except as a special case, by version,
   and except for a few specific package attributes such as the application
   title and icon.)

异常就是这样,一开始还把

<string name="facebook_app_id" translatable="false">******************</string>
直接复制到:zh\strings.xml 里面,又报出了另一个错误。所以最终的解决办法是:
<meta-data android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id"
    tools:ignore="ManifestResource"/>
<string name="facebook_app_id" translatable="false">*****************</string>
是的,在meta-data中加入
tools:ignore="ManifestResource"
以及在string 的字段里加上 translatable="false" 就是不翻译的意思,就是这么简单。
参照了:https://code.google.com/p/android/issues/detail?id=194705  和 http://stackoverflow.com/questions/35388688/android-facebook-app-id-showing-error-in-values-ta-strings-xml-and-cant-able

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值