问题1:
java.net.UnknownServiceException: CLEARTEXT communication ** not permitted by network security polic
在发送添加股票的请求后以上错误,是使用OKHttp请求出现的安全性问题,使用http请求则不会出现这样的问题。
解决方法:
1、在 res 下新增一个 xml 目录,然后创建一个名为:network_security_config.xml 文件(名字自定),内容如下,大概意思就是允许开启http请求,代码内容如下:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
2、然后在APP的AndroidManifest.xml文件下的application标签增加以下属性:
<application
...
android:networkSecurityConfig="@xml/network_security_config"
...
/>
问题2:
虚拟机时间一长会提示:System UI isn’t responding
解决:
1、打开虚拟机管理器
进入项目后,选择View中的Tool Window中的Device Manager即可打开虚拟机管理器。
2、点击最右边的倒三角选择Wipe Data即可。
3、重新开启虚拟机即可解决问题,重新启动时记得将原虚拟机关闭。
问题3:
代码标红并报错:editText_stockId : Touch target size too small
解决: 设置最小高度即可。
问题4:
向GitHub中push代码时失败。
原因:git无法合并两个不相关的代码。
解决:把GitHub上的代码pull下来,然后输入:
git merge --allow-unrelated-histories
再push即可。
接口
腾讯股票:
http://qt.gtimg.cn/q=