【发布时间】:2020-05-15 18:50:55
【问题描述】:
所以我已经配置了 php 文件并且我的 wamp 尝试连接到数据库但它抛出一个错误我什至保留了网络安全证书但仍然抛出错误。
尝试过的解决方案 1. 新增 android:usesCleartextTraffic="true"。 2.将地址更改为ipv4地址。 3.增加安全文件 清单xml:
android:networkSecurityConfig="@xml/network_security_config";
network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
<debug-overrides>
<trust-anchors>
<certificates src="user" overridePins="true"/>
</trust-anchors>
</debug-overrides>
</network-security-config>
错误:
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
W/System.err: java.io.FileNotFoundException: http://10.0.2.2/login.php
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:250)
at com.example.mysqltest.BackgroundWorker.doInBackground(BackgroundWorker.java:46)
at com.example.mysqltest.BackgroundWorker.doInBackground(BackgroundWorker.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
D/EGL_emulation: eglMakeCurrent: 0x9d285120: ver 2 0 (tinfo 0x9d2831f0)
D/EGL_emulation: eglMakeCurrent: 0x9d285120: ver 2 0 (tinfo 0x9d2831f0)
W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
Process 13292 terminated.
【问题讨论】: