![](/img/trans.png)
[英]Android-Volley: TimeOutError when trying to connect from a real device
[英]AuthFailure while trying to connect android device to wampserver(localhost) using volley
我正在尝试使用android volley将我的Android设备连接到localhost即wampserver
这是我的代码:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url = "http://192.16x.x.xxx/folderName/ClutchTester.php";
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(getApplicationContext(),response.toString(),Toast.LENGTH_LONG).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),error.toString(),Toast.LENGTH_LONG).show();
}
});
Volley.newRequestQueue(getApplicationContext()).add(request);
}
}
Toast说AuthFailureError 。 我在这里使用的IP地址是IPv4地址。 有谁知道我为什么会收到这个错误以及如何解决这个问题?
尝试将固定IP分配给您的电脑而不是自动获取
当你完成
原因:您的路由器可能找不到您使用的IP,因为自动分配了IP。
别忘了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.