Android 开发遇到的坑

1、Android 7.0拍照、选择照片相关错误

2、Android 8.0 Only fullscreen opaque activities can request orientatio

3、app崩溃后,带fragment的activity恢复的坑

下面2篇文章说的一样
app崩溃后,带fragment的activity恢复的坑
添加链接描述

4、小米手机权限问题

补充:主要想说上面那篇文章的评论,部分小米手机出现第一次授权拒绝后,在权限管理中打开权限,仍旧获取的是第一次询问权限的状态,貌似这个问题小米还没有解决。下面是别人在官网提出的:
http://www.miui.com/forum.php?mod=viewthread&tid=18959652&highlight=权限
这种如果是用户的话就只能卸载重装应用允许权限才行。

5、Android Studio 创建module时版本不统一

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

解决:

 configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
    }

Android 9.0 permitted network secrity

permitted network secrity

BitmapFactory.decodeResource()返回null

public static Bitmap getBitmap(Context context, int vectorDrawableId) {
        Bitmap bitmap=null;
        if (Build.VERSION.SDK_INT>Build.VERSION_CODES.LOLLIPOP){
            Drawable vectorDrawable = context.getDrawable(vectorDrawableId);
            bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
                    vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(bitmap);
            vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
            vectorDrawable.draw(canvas);
        }else {
            bitmap = BitmapFactory.decodeResource(context.getResources(), vectorDrawableId);
        }
        return bitmap;
    }

你可能感兴趣的:(Android,android,开发遇到的坑)