█ 【安卓学习之常见问题】 编译V7问题- ‘android:Widget.Material.Button.Colored’.
█ 问题:
● 由于某些原因下载了个android-support-v7-appcompat_23.1.1的工程项目,要引用里面的部分主题功能
起初下载了个aar格式的【appcompat-v7-26.1.0】,不方便使用,又下了个jar的【android-support-v7-appcompat 26.1.0最新】,也不算工程项目
● 下载编译下,在appcompat\res\values-v23\styles_base.xml出现如下问题:
styles_base.xml:19: error: Error retrieving parent for item: No resource found that matches the given name ‘android:Widget.Material.Button.Colored’.
styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name ‘android:TextAppearance.Material.Widget.Button.Inverse’.
█ 解决:
● 1.将project.properties文件的target属性修改为23以上的即可:
target=android-25
PS:编译没通过的话,可以clean一下即可
█ 总结:
● 如果代码没有问题的话,基本上是修改project.properties中的【target】属性,或者修改AndroidManifest.xml中的【uses-sdk】属性:
PS:【uses-sdk】属性主要有minSdkVersion和targetSdkVersion两项
● 最后,这边我也整理了个 26.1.0的版本
PS:以下是打包好的三个供eclipse版本使用的android-support-v7包,其中【android-support-v7-appcompat_00.0.0_20150325.zip】 不知道是哪个版本的,【android-support-v7-appcompat_23.1.1_20151124.rar】是23.1.1版android6.0,【android-support-v7-appcompat_26.1.0_20170913.zip】是26.1.0版android8.0
下载地址:android-support-v7-appcompat(含23和26)_20180518.zip-CSDN下载(注意修改编译条件)
● 由于引入了V7和新的sdk,将导致另一个问题的产生1:
[Dex Loader] Unable to execute dex: Cannot merge new index 66457 into a non-jumbo instruction!
[XXX] Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 66457 into a non-jumbo instruction!
PS1:将jar合并类成dex时,每一个方法都分配有一个id(合并类),当方法超过65535,就会遇到这个问题,解决方法就是在
PS2:解决方法就是在在project.properties文件末尾处添加【dex.force.jumbo=true】,记得要clean/清理工程,并重新编译。
● 由于引入了V7和新的sdk,将导致另一个问题的产生2:You need to use a Theme.AppCompat theme (or descendant) with this activity
● 由于引入了V7和新的sdk,将导致另一个问题的产生3:
java.lang.UnsatisfiedLinkError: dlopen failed: “/data/app/com.**-aWY-jD4bv3PSuqky5cL67Q==/lib/arm/libSDL.so” has text relocations (https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)
█ 相关资料:
● 1.2013-07-23 异常分析:Unable to execute dex: Cannot merge new index 71813 into a non-jumbo instruction! - super_spy的专栏 -CSDN博客
● 2.2014-06-23 Android-Cannot merge new index 66195 into a non-jumbo instruction的解决办法 - 若鱼的专栏 - CSDN博客
● 3.2015-12-12【Android】1分钟不用改任何代码在Eclipse中使用AAR - 浮游大虾 - 简书
● 4.2016-05-06 我的Android进阶之旅——>解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity. - 欧阳鹏 - CSDN博客
● 5.2017-03-14 No resource found that matches the given name ‘android:Widget.Material.Button.Colored’ 解决 - CSDN博客
● 6.2017-04-02 libxxx.so- text relocations问题的终极解决方案 - aspook - CSDN博客
转载请注明出处:
http://blog.csdn.net/ljb568838953/article/details/80360978