我是靠谱客的博主 无心天空,最近开发中收集的这篇文章主要介绍在android_studio运行cordova项目时遇到的问题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

一、All packages are not available for download! The following packages are not available:- Package id platforms;android-19

在这里插入图片描述
项目运行后报这个错但是还能在模拟器上打开,只是在项目尝试下载这些包下载不了之后,过程很长,在问题二解决后这个问题也没有了 。

二、-source 1.6中不支持diamond运算符,请使用-source 7或更高版本以启用diamond 运算符

在这里插入图片描述
在这里插入图片描述
解决:修改File->Project Structure->android
在这里插入图片描述
在这里插入图片描述
参考:https://blog.csdn.net/aliaooooo/article/details/42536295

三、在html添加script事件无反应,在js里也是

解决:在html中添加script-src * 'unsafe-inline'

        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;script-src * 'unsafe-inline'">

其实控制台当时也有提示,只是不知道啥意思

10-19 09:46:48.370 1606-1606/io.cordova.hellocordova D/SystemWebChromeClient: file:///android_asset/www/index.html: Line 45 : Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
10-19 09:46:48.370 1606-1606/io.cordova.hellocordova I/chromium: [INFO:CONSOLE(45)] "Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
                                                                 ", source: file:///android_asset/www/index.html (45)

参考:https://blog.csdn.net/u011127019/article/details/55253167

四、中文会乱码问题

待解决

五、插件调用

调用了一下摄像头

https://www.cnblogs.com/lishuxue/p/6018416.html

六、Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

参考:https://blog.csdn.net/qq_20473985/article/details/68490438

最后

以上就是无心天空为你收集整理的在android_studio运行cordova项目时遇到的问题的全部内容,希望文章能够帮你解决在android_studio运行cordova项目时遇到的问题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部