图片命名问题
AS对图片命名要求比eclipse严格,图片名称只能有 小写字母、数字及下划线组成;9png错误
AS中,.9图必须是规范的.9图,否则就会报错;
(1)如果一张图不是.9图,则图片名称中不要包含.9;
(2).9图必须对四个边都进行了描点,AS才能进行识别;android.support.v4.app
(1)Error:(8, 30) 错误: 程序包android.support.v4.app不存在
(2)Error:(193, 19) 错误: 找不到符号
解决方法:引入新版support.v4Android6.0(SDK 23)及以上没有httpclient,报错
解决方法:
在build.gradle中添加如下配置
android {
……
//android6.0 没有httpclient了,如用android23编译,需要加上该行,android23以下的不需要加这行
useLibrary ‘org.apache.http.legacy’
……
}
5.厉害了>>>
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar
File2: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar
File3: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\
解决方法:
As the error message suggests you are not excluding the META-INF/LICENSE file which exists in more than one of your dependencies
com.Android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
在app build.gradle文件内配置:
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
}
6、 Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
解决方案:
1、在styles文件内新建样式主题
<style name="AppCompatTheme" parent="Theme.AppCompat.Light.NoActionBar"></style>
2、在需要的Activity的onCreate添加
setTheme(R.style.AppCompatTheme);
注:setContentView之前设置
7、android 7.0系统解决拍照的问题android.os.FileUriExposedException
除了解决方案之外FileProvider,
在Application.onCreate()。以这种方式,VM会忽略文件URI曝光。
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
builder.detectFileUriExposure()
启用文件曝光检查,如果我们没有设置VmPolicy,这也是默认行为。