安卓,rebuild apk错误解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoyu_93/article/details/64130078

之前都还好好的,过了个周末去公司发现,使用apktool等工具对apk进行解包,使用新的签名文件再次签名生成apk时,遇到报错提示:

1、No resource found that matches the given name ‘@android:style/Animation.OptionsPanel’.
2、 No resource found that matches the given name ‘@android:style/Animation.LockScreen’.

原因是在styles.xml文件中,有如下代码,删除即可。

<style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"            parent="@android:style/Animation.OptionsPanel" />
<style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="@android:style/Animation.LockScreen" />

而我当时找遍了所有的styles.xml文件都没看到有这两行,后来才发现,原来在gradle中引用了第三方库,且版本号使用的+,代表永远使用最新的版本。所以我的出错的原因是使用第三方库的最新版本,而那个库可能刚好去更新了代码加了这两行代码,所以本地的apk里面也就有这个问题存在了。

总结:

  1. 遇事要冷静,好好分析问题。
  2. 百度不到解决方案的话试试Google呀,我这个问题就是Google出来的。
  3. Google原文,看了文章后确定问题根源,检查自己代码没有这个,检查第三方库才找出具体问题所在。

猜你喜欢

转载自blog.csdn.net/xiaoyu_93/article/details/64130078
今日推荐