VideoView 似乎有问题,在 Proguard 下无法正常工作。开始播放视频时会出现以下屏幕。
VideoView的代码如下:
mediaController= new MediaController(this);
mediaController.hide();
mediaController.setAnchorView(video_animation);
Uri uri= Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.splash_min);
video_animation.setMediaController(mediaController);
video_animation.setVideoURI(uri);
video_animation.requestFocus();
video_animation.start();
也没有为运行 VideoView 添加特定的 ProGuard 设置。
build.gradle 的摘录
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
resValue "string", "FB_APP_ID", getFbAppKey()
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
resValue "string", "FB_APP_ID", getFbAppKey()
}
}
还有一些产品 flavor 仅用于操纵应用程序 ID。
最佳答案
在原始文件夹中添加 keep.xml。
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@raw/splash_min"
/>
关于android - 视频 View 在 Proguard 下不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45657418/