簡體   English   中英

AuthFailure嘗試使用凌空將android設備連接到wampserver(localhost)

[英]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分配給您的電腦而不是自動獲取

當你完成

  • 現在你的路由器知道在哪里發送這些數據包如果獲得和在你的電腦你的wampserver將處理休息。

原因:您的路由器可能找不到您使用的IP,因為自動分配了IP。

別忘了

  • 在您的代碼中使用為PC修復的IP更改您的url ip。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM