1

I've written a module for network APIs in order to import it in 2 apps. In this module I use volley. The first time that I've generated the module.aar and imported it in other project, it work. Now, I've runtime error

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/android/volley/Response$Listener;

I've:

  • clean app and module through ./gradlew clean

  • added in proguard module file

    -keep class com.android.volley.Response { *; } -keepclassmembers class com.android.volley.Response { *; } -keepclassmembers class com.android.volley.Response$Listener { *; } -keep class com.android.volley.Response$Listener { *; }

  • disabled proguard in debug config mode for network module

Nothing of this is good, I still receive NoClassDefFoundError when initialize Volley.

The gradle file of module is:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
}

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug{
            debuggable true
            minifyEnabled false
            useProguard false
        }
    }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.android.volley:volley:1.1.0'
}

Thank you!

benjaminbutton
  • 143
  • 1
  • 16

0 Answers0