android - java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable -


i new actionbaractivity, application crashed while running following code in eclipse public class login extends actionbaractivity {

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_login);     if (savedinstancestate == null) {         getsupportfragmentmanager().begintransaction()         .add(r.id.container, new placeholderfragment()).commit();     }  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.login, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();     if (id == r.id.action_settings) {         return true;     }     return super.onoptionsitemselected(item); }  /**  * placeholder fragment containing simple view.  */ public static class placeholderfragment extends fragment{      public placeholderfragment() {     }      @override     public view oncreateview(layoutinflater inflater, viewgroup container,             bundle savedinstancestate) {         view rootview = inflater.inflate(r.layout.fragment_login,                 container, false);         return rootview;     } } 

}

where import

import android.support.v4.app.fragment;

import android.support.v7.app.actionbaractivity;

but still got errors in logcat follows:

01-27 16:47:13.091: e/androidruntime(320): fatal exception: main 01-27 16:47:13.091: e/androidruntime(320): process: com.element45.android.localsale.activities, pid: 320 01-27 16:47:13.091: e/androidruntime(320): java.lang.noclassdeffounderror: failed resolution of: landroid/support/v7/appcompat/r$styleable; 01-27 16:47:13.091: e/androidruntime(320):  @ android.support.v7.app.actionbaractivitydelegate.oncreate(actionbaractivitydelegate.java:107) 01-27 16:47:13.091: e/androidruntime(320):  @ android.support.v7.app.actionbaractivitydelegateics.oncreate(actionbaractivitydelegateics.java:58) 01-27 16:47:13.091: e/androidruntime(320):  @ android.support.v7.app.actionbaractivity.oncreate(actionbaractivity.java:98) 01-27 16:47:13.091: e/androidruntime(320):  @ com.element45.android.localsale.activities.login.oncreate(login.java:18) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activity.performcreate(activity.java:6289) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1119) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activitythread.performlaunchactivity(activitythread.java:2646) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activitythread.handlelaunchactivity(activitythread.java:2758) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activitythread.access$900(activitythread.java:177) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activitythread$h.handlemessage(activitythread.java:1448) 01-27 16:47:13.091: e/androidruntime(320):  @ android.os.handler.dispatchmessage(handler.java:102) 01-27 16:47:13.091: e/androidruntime(320):  @ android.os.looper.loop(looper.java:145) 01-27 16:47:13.091: e/androidruntime(320):  @ android.app.activitythread.main(activitythread.java:5942) 01-27 16:47:13.091: e/androidruntime(320):  @ java.lang.reflect.method.invoke(native method) 01-27 16:47:13.091: e/androidruntime(320):  @ java.lang.reflect.method.invoke(method.java:372) 01-27 16:47:13.091: e/androidruntime(320):  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1388) 01-27 16:47:13.091: e/androidruntime(320):  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1183) 01-27 16:47:13.091: e/androidruntime(320): caused by: java.lang.classnotfoundexception: didn't find class "android.support.v7.appcompat.r$styleable" on path: dexpathlist[[zip file "/data/app/com.element45.android.localsale.activities-1/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] 01-27 16:47:13.091: e/androidruntime(320):  @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) 01-27 16:47:13.091: e/androidruntime(320):  @ java.lang.classloader.loadclass(classloader.java:511) 01-27 16:47:13.091: e/androidruntime(320):  @ java.lang.classloader.loadclass(classloader.java:469) 01-27 16:47:13.091: e/androidruntime(320):  ... 17 more 01-27 16:47:13.091: e/androidruntime(320):  suppressed: java.lang.classnotfoundexception: android.support.v7.appcompat.r$styleable 01-27 16:47:13.091: e/androidruntime(320):      @ java.lang.class.classforname(native method) 01-27 16:47:13.091: e/androidruntime(320):      @ java.lang.bootclassloader.findclass(classloader.java:781) 01-27 16:47:13.091: e/androidruntime(320):      @ java.lang.bootclassloader.loadclass(classloader.java:841) 01-27 16:47:13.091: e/androidruntime(320):      @ java.lang.classloader.loadclass(classloader.java:504) 01-27 16:47:13.091: e/androidruntime(320):      ... 18 more 01-27 16:47:13.091: e/androidruntime(320):  caused by: java.lang.noclassdeffounderror: class not found using boot class loader; no stack available 

thank you

you should use #android studio instead of eclipse .

01-27 16:47:13.091: e/androidruntime(320): caused by: java.lang.classnotfoundexception: didn't find class "android.support.v7.appcompat.r$styleable" on path: dexpathlist[[zip file "/data/app/com.element45.android.localsale.activities-1/base.apk"],nativelibrarydirectories=[/vendor/lib, /system/lib]] 01-27 16:47:13.091: e/androidruntime(320): @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) 01-27 16:47:13.091: e/androidruntime(320): @ java.lang.classloader.loadclass(classloader.java:511) 01-27 16:47:13.091: e/androidruntime(320): @ java.lang.classloader.loadclass(classloader.java:469) 01-27 16:47:13.091: e/androidruntime(320): ... 17 more 01-27 16:47:13.091: e/androidruntime(320): suppressed: java.lang.classnotfoundexception: android.support.v7.appcompat.r$styleable

noclassdeffounderror error thrown when java virtual machine (jvm) or instance of classloader class tries load definition of class, definition not found.

bad approach : using deprecated code (actionbaractivity).

at first extends appcompatactivity instead of actionbaractivity .

public class login extends appcompatactivity {   // ... } 

advice

set android:minsdkversion version .

<uses-sdk android:minsdkversion="15" /> 

try way ,hope woks .


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -