繁体   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