How to avoid NoClassDefFoundError with different Android API versions -
i'm developing application apis v10 v17.
my activity implements ondraglistener available api v14.
public class myactivity extends activity implements view.ondraglistener { .... }
so, when application installed on device api v10 fails load activity java.lang.noclassdeffounderror
.
i understand won't work on api v10, that's ok. i'm handling inside activity.
i want know practice handle different api versions when comes features this?
first of can check api levels , depending on execute or not code. example :
if(build.version.sdk_int < build.version_codes.honeycomb){ // don't use it. } else { // use new api : // myview.setondraglistener(...); }
you should not implement interfaces new api's in activity if want support old android versions too. instead of use approach above.
Comments
Post a Comment