I recently upgraded my build environment to Android studio 2.2, JDK 1.8 (with jack) and I am using gradle wrapper with gradle-2.14.1. My build/release variants compile and run properly on any android release > K. However when I try to run the code on an android K device, the code compiles fine and apk is generated properly but the code immediately crashes with stack trace below as the code can't seem to find BuildConfig class. Would appreciate any pointers that I can possibly look into. Thanks!
FATAL EXCEPTION: main Process: com.trail.android.debug, PID: 21045 java.lang.NoClassDefFoundError: com.trail.android.BuildConfig at com.trail.android.TrailApplication.attachBaseContext(TrailApplication.java:41) at android.app.Application.attach(Application.java:181) at android.app.Instrumentation.newApplication(Instrumentation.java:991) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) 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)
BuildConfigclass should be automatically generated by Android.. or did you create your own (which is bad)? Have you tried doing Build -> Clean Project -> Rebuild Project? - Gino MempinminSdkVersion? have you tried also updating the build tools or the Android gradle plugin versions? - Gino Mempin