利用cordova插件为APP添加启动页面cordova plugin add cordova-plugin-splashscreen

修改config.xml文件

         <splash density="land-hdpi" src="res/screen/android/screen-hdpi-landscape.png" />
        <splash density="land-ldpi" src="res/screen/android/screen-ldpi-landscape.png" />
        <splash density="land-mdpi" src="res/screen/android/screen-mdpi-landscape.png" />
        <splash density="land-xhdpi" src="res/screen/android/screen-mdpi-landscape.png" />
        <splash density="port-hdpi" src="res/screen/android/screen-xhdpi-landscape.png" />
        <splash density="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
        <splash density="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
        <splash density="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />

clipboard.png

运行APP cordova run,程序报错

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

clipboard.png

问题所在

我在网上下载的jpg图片,然后直接改格式为png,放入启动动画的目录中

clipboard.png

结果gradle检查了PNG的合法性,由于我改图片的格式方式比较粗暴,所以就报错了

解决办法

1.使用正规的PNG格式的图片,不能是我这种粗暴方法改成的

2.修改build.gradle文件

注意看清目录结构

clipboard.png

aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false

这两句的作用是禁止gradle检查PNG格式图片的合法性


卖女孩的小火柴
2k 声望260 粉丝

while(1){


引用和评论

0 条评论