![](/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.