There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
error:resource android:attr/colorError not found.
error:resource android:attr/colorError not found.
error:style attribute "android:attr/keyboardNavigationCluster" not found.
error:resource android:attr/fontStyle not found.
error:resource android:attr/font not found.
error:resource android:attr/fontWeight not found.
解决办法:https://blog.csdn.net/u012862619/article/details/80475908
- 方法一
将build.gradle
中的所有support
依赖改为27.1.1
implementation 'com.android.support:appcompat-v7:27.1.1'
- 1
- 方法二
如果以上方法不行,在
dependencies{}
完成后做相关配置
configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
}
方法三:
仔细查看 错误信息Program type already present:后面的提示(看是哪个包中的错误),将对应包屏蔽,例如:
implementation('com.android.support:appcompat-v7:27.1.0', { exclude group: 'com.android.support', module: 'design'})
implementation('com.android.support:recyclerview-v7:27.1.0', { exclude group: 'com.android.support', module: 'design'})
implementation('com.android.support:cardview-v7:27.1.0', { exclude group: 'com.android.support', module: 'design'})
方法四:查看app的build.gradle是否只有一个v7包,在后边加上对应版本的design包。再不行的话接着加v4包,再不行接着加cardview包,再不行加recycleview包。
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1'
☆☆☆☆☆☆☆☆☆☆☆☆☆☆我是通过方法四解决的。
Error:Execution failed for task ':app:processDebugManifest'
第一种
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/filepaths) from AndroidManifest.xml:393:17-50
is also present at [com.jph.takephoto:takephoto_library:4.0.3] AndroidManifest.xml:24:17-51 value=(@xml/file_paths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml:391:13-393:53 to override.
看到上面错误说明相信大家也明白为什么报错,造成这个问题的原因是,我在自己的应用中使用了FileProvider,然而依赖库中也是用了FileProvider,所以造成了这个问题的出现,按照提示进行修改,就不会再保存了Android 从 N 开始不允许以 file:// 的方式通过 Intent 在两个 App 之间分享文件,取而代之的是通过 FileProvider 生成 content://Uri 。如果在 Android N 以上的版本继续使用 file:// 方式分享文件,则系统会直接抛出异常,导致 App 出现 Crash
第二种
使用FileProvider的相关配置后,Manifest文件中权限重复也出现了这种问题,去重就好了
第三种
就是依赖的库的targetSdkVersion和主module的targetSdkVersion版本号不一致导致的,需要统一下,所以要注意系统的适配
第四种
Manifest merger failed with multiple errors, see logs
出现这个错误的原因是:多个module的Manifest文件中application标签中的属性因为相同从而冲突,解决方法:在主module(也就是app)中 Manifest 为application标签加如下属性:tools:replace="android:icon,android:theme,android:allowBackup",前提是根标签要有:xmlns:tools="http://schemas.android.com/tools"
关于FileProvider的使用网上有很多,这里不多讲,可以看看这个:http://blog.csdn.net/duanyy1990/article/details/68961159
问题1:
Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multiple errors, see logs
在网上查到了一些这个问题的解决办法:
方法一:
1)在Manifest根标签加上 xmlns:tools="http://schemas.android.com/tools"
2)<user-sdk tools:overrideLibrary="自己需要强制替换的库"/>
3)在Manifest.xml的application标签下添加 tools:replace="android:icon, android:label,android:theme"
方法二:
在build.gradle根标签上加上useOldManifestMerger true (懒人方法)
但是上边的方法并没有解决我的问题,后来通过检查AndroidManifest.xml文件,发现、
<meta-data android:name="UMENG_APPKEY" android:value="*****">
被重复声明了两次,去掉其中一个就可以了,问题解决。
问题2:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/appcompat/R$anim.class
问题3:
RecyclerView在更新数据是,出现:java.lang.IllegalArgumentException Scrapped or attached views may not be recycled. isScrap:false isAttached:true
问题是因为在获取新数据事将数据集合清除了,但是没有notifyDataSetChanged.可以将清除集合操作在获取数据之后将原来的集合清除,然后再将新数据加到集合中调用adapter的notifyDataSetChanged()方法.问题4:
最近一个朋友问我一个问题:Toast中的内容不居中显示,一开始他传入的Context是Activity,我让他修改成getBaseContext()、getApplicationContext()都不行。后来查找到在Application 配置的主题中设置了fitsSystemWindows=true ,注释掉就可以了。
问题5:
最近以为群友出现了一个问题:Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not requestWindow.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
提示添加toolbar失败,已经存在了actionbar。
解决办法:
方式一:将主题替换为NoTitleBar主题;
方式二:将当期主题的notitle设置为true;