android 适配
2020-03-06 本文已影响0人
读书人heart
一、android8.0和华为荣耀10(特别是荣耀机型(P20,10等))闪退
原因1:使用了透明的状态栏的主题
二、Only fullscreen opaque activities can request orientation异常
在微信授权登录时,抛出异常Only fullscreen opaque activities can request orientation
解决办法就是在Manifest中把腾讯的Activity中android:screenOrientation="portrait"属性删掉。
aapt命令打包已有项目apk 找不到style里面的字段是因为要加入v7包
三、去除android打包后一些隐私权限(华为上架会检查)
1、在app模块的build.gradle添加这段代码(在外层)
project.afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processResources.doFirst { pm ->
String manifestPath = output.processResources.manifestFile;
def manifestContent = file(manifestPath).getText()
manifestContent = manifestContent.replace('android.permission.READ_SMS','android.permission.INTERNET' )
manifestContent = manifestContent.replace('android.permission.SEND_SMS','android.permission.INTERNET' )
file(manifestPath).write(manifestContent)
}
}
}
}
2、在app模块的build.grade添加apply from: 'filterPermission.gradle
apply from: 'filterPermission.gradle'
四、android闪屏页适配(图片尺寸太大会导致android7.0OOM)
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<color android:color="@color/white"/>
</item>
<item android:bottom="200px"
android:width="479px"
android:height="162px"
android:gravity="bottom|center">
<bitmap
android:src="@drawable/bottom_lcon"/>
</item>
<item
android:width="989px"
android:height="1092px"
android:gravity="center">
<bitmap
android:src="@drawable/center_lcon"/>
</item>
</layer-list>
五、android 10 出现图片选择库图片或者视频显示灰色 (android10适配)
在AndroidManifest.xml的application节点添加android:requestLegacyExternalStorage="true"