garretyoder/Colorful

R styles not found on API 19

defvs opened this issue · 1 comments

defvs commented

Hello,
I am encountering an issue when running the library on API 19 (Android 4.1)...
R seems to not be created correctly on compile.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dev.defvs.chatterz, PID: 2735
    java.lang.NoClassDefFoundError: io.multimoon.colorful.R$style
        at io.multimoon.colorful.ThemeColor.<clinit>(ThemeColor.kt:60)
        at dev.defvs.chatterz.MainApplication.onCreate(MainApplication.kt:13)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
        at android.app.ActivityThread.access$1500(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)
defvs commented

If anyone faces this:

  • You probably have Multidex enabled.
  • Your Application doesn't attach the correct Multidex context

Either extend MultiDexApplication and run MultiDex.install(this) in attachBaseContext()
or if you don't have an application class, simply add android:name="android.support.multidex.MultiDexApplication" in your manifest's Application.

Source : https://developer.android.com/studio/build/multidex#mdex-gradle