2

I have already referred to other answers like this, but still getting the following exception :

E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/android/volley/toolbox/Volley;

Here are the dependencies :

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-base:12.0.1'
    implementation 'com.google.android.gms:play-services-location:12.0.1'
    implementation "com.google.firebase:firebase-messaging:15.0.0"
    implementation 'com.google.firebase:firebase-core:12.0.1'
    implementation 'com.android.volley:volley:1.1.0'

    apply plugin: 'maven'
}  

As a matter of fact, when I try adding Volley as a dependency, it is never shown in the list of dependencies. Whereas other google libraries are displayed.

Note : I have already checked other StackOverFlow links, so please, only if you are absolute sure that an answer is correctly working for this, feel free to mark this a duplicate.

Nitish
  • 13,845
  • 28
  • 135
  • 263
  • you can download Volley from https://github.com/google/volley and import into your project as a module, in your gradle file, you can try `implementation project(':Module_Volley')` where Module_Volley is my module name for volley lib – Chauyan Apr 17 '18 at 06:49

2 Answers2

1

Open Command prompt and redirect to your project directory and type this

If you are a Windows user: gradlew.bat clean

if you are a mac user type: ./gradlew clean

newbie
  • 31
  • 4
0

If your targetSdkVersion is between 26 and 28, try adding uses-library android:name="org.apache.http.legacy" android:required="false" in application tag in AndroidManifest. The second approach is: import volley.jar into your app/lids directory and instead of fetching it from gradle, use your local jar as implementation files('libs/volley.jar') in build.gradle in app module

Denys Lobur
  • 124
  • 5