RxJava noClassDefFoundError: rx.plugins.RxJavaPlugins on API 16

前端 未结 2 1899
借酒劲吻你
借酒劲吻你 2021-01-11 21:34

I am developing an Android application using RxJava and Retofit. When I test my code on API 23 I get no errors however when I test in API 15, my RxJava doesnt appear to work

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-11 22:03

    Thanks for bikash, his top solution really works.Yet in my program, my Application class has extended another ***Application. I finally solve this by overriding attachBaseContext(Context base) function in my application class to initial MultiDex. In a word, I do like this:

    defaultConfig {//first step
            multiDexEnabled true
        }
    
    dependencies {compile 'com.android.support:multidex:1.0.1'}//second
    
     @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);//finally
    }
    

    You can get more information from this page

提交回复
热议问题