Volley 库的编译依赖项的替代方案是什么 - Android

What is the alternative of the compile dependencies for Volley library - in Android

因为我使用了 Volley Lib。在我的项目中有依赖项

compile 'com.mcxiaoke.volley:library:1.0.19'

这个依赖允许我使用

RequestQueue requestQueue;

这在 google Volley 库依赖项中是不允许的。

但是 Android Studio build.gradle 警告消息是 注意:不要放置您的应用程序依赖项....配置 'compile' 已过时并已替换为'implementation'。将于2018年底移除。Java编译错误。

所以,我正在 androidTestImplementation

中寻找这些依赖项或 Volley lib 依赖项的替代方案

Here is my code. which is working absolutely fine but I need an alternate of this lib.

public class LoginActivity extends AppCompatActivity {

    private Button admin_login;
    private EditText admin_mob, admin_pass;
    private RequestQueue requestQueue;
    private static final String URL = "https://indinity.com/json_data.php";
    private StringRequest request;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        admin_login = findViewById(R.id.button);
        admin_mob = findViewById(R.id.editText);
        admin_pass = findViewById(R.id.editText2);

        requestQueue = Volley.newRequestQueue(this);

        admin_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                request = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try {
                            JSONObject jsonObject = new JSONObject(response);
                            if(jsonObject.names().get(0).equals("success"))
                            {
                                Toast.makeText(getApplicationContext(),"Success "+jsonObject.getString("success"),Toast.LENGTH_LONG).show();
                                startActivity(new Intent(getApplicationContext(),OptionActivity.class));
                            } else {
                                Toast.makeText(getApplicationContext(),"Error "+jsonObject.getString("error"),Toast.LENGTH_SHORT).show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }


                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {

                    }
                }){
                            @Override
                            protected Map<String, String> getParams() throws AuthFailureError {
                            HashMap<String, String> hashMap = new HashMap<String, String>();
                            hashMap.put("adminmob", admin_mob.getText().toString());
                            hashMap.put("password", admin_pass.getText().toString());
                            return hashMap;

                    }
                };

                requestQueue.add(request);
            }
        });



    }
}

只是改变

compile 'com.mcxiaoke.volley:library:1.0.19'

implementation 'com.mcxiaoke.volley:library:1.0.19'

参见:Migrate to Android Plugin for Gradle 3.0.0