1.AS可以链接后台;至于后台是哪种语言写的 都是可以的
2.在链接httpok的时候。需要引用包;
implementation 'com.squareup.okhttp:okhttp:2.7.0' implementation 'com.squareup.okio:okio:1.7.0' implementation 'com.squareup.okhttp3:okhttp:3.2.0' implementation 'com.squareup.okhttp:okhttp:2.4.0' 3.
OkHttpClient client = new OkHttpClient.Builder().readTimeout(1, TimeUnit.SECONDS).build(); String yhm="lyc"; String password="666666"; Request request = new Request.Builder().url("http://192.168.25.163:8011/Handler/AndroidStudio.ashx?action=login&yhm="+yhm+"&password="+password) .get().build(); Call call = client.newCall(request); try { Response response = call.execute(); Toast.makeText(MainActivity.this, response.body().string(), Toast.LENGTH_SHORT).show(); System.out.println(response.body().string()); } catch (IOException e) { e.printStackTrace(); }