首页 > 解决方案 > Volley ClassNotFoundException com.android.volley.Response$Listener

问题描述

我为网络 API 编写了一个模块,以便将其导入 2 个应用程序中。在这个模块中,我使用凌空。我第一次生成 module.aar 并将其导入其他项目时,它可以工作。现在,我有运行时错误

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

我有:

这没什么好,我在初始化 Volley 时仍然收到 NoClassDefFoundError。

模块的gradle文件是:

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'
}

谢谢!

标签: androidandroid-volleynoclassdeffounderror

解决方案


推荐阅读