In Android, when referencing other projects, especially related libraries in GitHub, it is easy to classnotfoundexception if the reference relationship settings are incorrect, such as the following exception information
07-26 12:47:51.549:e/androidruntime (8107): FATAL exception:main
07-26 12:47:51.549:e/androidruntime (8107): java.lang.RuntimeException:Unable to start activity componentinfo{ Com.android.ex.chips.sample/com.android.ex.chips.sample.mainactivity}: Android.view.InflateException:Binary XML File line #23: Error inflating class Com.android.ex.chips.RecipientEditTextView
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2081)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java : 2106)
07-26 12:47:51.549:e/androidruntime (8107): at android.app.activitythread.access$600 (ActivityThread.java:137)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.activitythread$h.handlemessage (ActivityThread.java:1202 )
07-26 12:47:51.549:e/androidruntime (8107): at Android.os.Handler.dispatchMessage (handler.java:99)
07-26 12:47:51.549:e/androidruntime (8107): at Android.os.Looper.loop (looper.java:137)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.ActivityThread.main (activitythread.java:4897)
07-26 12:47:51.549:e/androidruntime (8107): at Java.lang.reflect.Method.invokeNative (Native Method)
07-26 12:47:51.549:e/androidruntime (8107): at Java.lang.reflect.Method.invoke (method.java:511)
07-26 12:47:51.549:e/androidruntime (8107): at Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:808)
07-26 12:47:51.549:e/androidruntime (8107): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:575)
07-26 12:47:51.549:e/androidruntime (8107): at Dalvik.system.NativeStart.main (Native Method)
07-26 12:47:51.549:e/androidruntime (8107): caused by:android.view.InflateException:Binary XML file line #23: Error infl Ating class Com.android.ex.chips.RecipientEditTextView
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.createViewFromTag (Layoutinflater.java : 768)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.rInflate (layoutinflater.java:816)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.inflate (layoutinflater.java:559)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.inflate (layoutinflater.java:466)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.inflate (layoutinflater.java:417)
07-26 12:47:51.549:e/androidruntime (8107): at Com.android.internal.policy.impl.PhoneWindow.setContentView ( phonewindow.java:334)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.Activity.setContentView (activity.java:1942)
07-26 12:47:51.549:e/androidruntime (8107): at Com.android.ex.chips.sample.MainActivity.onCreate (Mainactivity.java : 34)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.Activity.performCreate (activity.java:5084)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.Instrumentation.callActivityOnCreate ( instrumentation.java:1079)
07-26 12:47:51.549:e/androidruntime (8107): at Com.lbe.security.service.core.client.b.x.callactivityoncreate ( Unknown Source)
07-26 12:47:51.549:e/androidruntime (8107): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2045)
07-26 12:47:51.549:e/androidruntime (8107): ... One more
07-26 12:47:51.549:e/androidruntime (8107): caused by:java.lang.ClassNotFoundException: Com.android.ex.chips.RecipientEditTextView
07-26 12:47:51.549:e/androidruntime (8107): at Dalvik.system.BaseDexClassLoader.findClass (Basedexclassloader.java : 61)
07-26 12:47:51.549:e/androidruntime (8107): at Java.lang.ClassLoader.loadClass (classloader.java:501)
07-26 12:47:51.549:e/androidruntime (8107): at Java.lang.ClassLoader.loadClass (classloader.java:461)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.createView (layoutinflater.java:622)
07-26 12:47:51.549:e/androidruntime (8107): at Android.view.LayoutInflater.createViewFromTag (Layoutinflater.java : 757)
07-26 12:47:51.549:e/androidruntime (8107): ... More
It is important to note that the Android SDK is first specified, followed by other projects that need to be referenced under Android in the main project properties, as shown in
Other reference methods, if the referenced project is not pure Java code (including Android drawable, layout, and other resources), the program is not running, such as the following method is wrong
Many solutions on the web say that, with reference to resources, adjust the order and Export, in fact, if the reference other resources using the Android reference method, will not appear under this tab under the cited item, as shown in
Finally talk about the feeling, in fact, a little bit of Android should know how to refer to the Android project, but from GitHub downloaded the entire sample, I feel that all quoted good, also forget this stubble, a run found wrong, began to Touyi, all kinds of import, all kinds of Internet search, In fact, calm down and analyze, you can immediately find the problem. Therefore, the first reaction after encountering a problem should not be to think about the solution immediately, but to learn to analyze the problem first.