1. add android-support-v4 error Java.lang.ClassNotFoundException:android.support.v4.view.ViewPager In Loade
problem: after adding Android-support-v4.jar with Viewpager, the following error is prompted
11-15 21:01:21.725:e/androidruntime (32431): caused by:java.lang.ClassNotFoundException: Android.support.v4.view.ViewPager in Loader dalvik.system.pathclassloader[/system/framework/ COM.GOOGLE.ANDROID.MAPS.JAR:/MNT/ASEC/COM.TRINEA.ANDROID.DEMO-2/PKG.APK]
The complete error is
I have added the Android-support-v4.jar package by using the Java build Path----Properties----External jars. Java build with Project-only properties Remove the jar from Path, and copy the jar package directly to the project's Libs directory. Because the jar package under Project Libs automatically imports the project, it does not need to be imported manually. The automatically imported packages exist under the Android private folder.
21:01:21.725:e/androidruntime (32431): FATAL exception:main-15 21:01:21.725:e/androidruntime (32431): Java.lang.RuntimeException:Unable to start Activity componentinfo{com.trinea.android.demo/ Com.trinea.android.demo.ViewPagerDemo}: Android.view.InflateException:Binary XML file line #7: Error inflating class Android.support.v4.view.viewpager-15 21:01:21.725:e/androidruntime (32431): at Android.app.ActivityThread.performLaunchActivity (activitythread.java:1664) -15 21:01:21.725:e/androidruntime ( 32431): At Android.app.ActivityThread.handleLaunchActivity (activitythread.java:1680) -15 21:01:21.725:e/ Androidruntime (32431): at android.app.activitythread.access$1500 (activitythread.java:117) -15 21:01:21.725:e/ Androidruntime (32431): at Android.app.activitythread$h.handlemessage (activitythread.java:931) -15 21:01:21.725:e/ Androidruntime (32431): at Android.os.Handler.dispatchMessage (handler.java:99) -15 21:01:21.725:e/androidruntime ( 32431): at Android.os.Looper.loop (Looper.java:130) -15 21:01:21.725:e/androidruntime (32431): at Android.app.ActivityThread.main (Activitythread.java : 3703) -15 21:01:21.725:e/androidruntime (32431): at Java.lang.reflect.Method.invokeNative (Native Method)-15 21:01:21.725:e/androidruntime (32431): at Java.lang.reflect.Method.invoke (method.java:507) -15 21:01:21.725:e/ Androidruntime (32431): at Com.android.internal.os.zygoteinit$methodandargscaller.run (ZygoteInit.java:841)-15 21:01:21.725:e/androidruntime (32431): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:599)-15 21:01:21.725:e/androidruntime (32431): at Dalvik.system.NativeStart.main (Native Method) -15 21:01:21.725:e/ Androidruntime (32431): caused by:android.view.InflateException:Binary XML file line #7: Error inflating class android.su Pport.v4.view.viewpager-15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.createViewFromTag (layoutinflater.java:581) -15 21:01:21.725:e/androidruntime (32431): at ANDROID.VIew. Layoutinflater.rinflate (layoutinflater.java:623) -15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.inflate (layoutinflater.java:408) -15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.inflate (layoutinflater.java:320) -15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.inflate (layoutinflater.java:276) -15 21:01:21.725:e/androidruntime (32431): at Com.android.internal.policy.impl.PhoneWindow.setContentView (phonewindow.java:212) -15 21:01:21.725:e/ Androidruntime (32431): at Android.app.Activity.setContentView (activity.java:1681) -15 21:01:21.725:e/ Androidruntime (32431): at Com.trinea.android.demo.ViewPagerDemo.onCreate (viewpagerdemo.java:28) -15 21:01:21.725:e /androidruntime (32431): at Android.app.Instrumentation.callActivityOnCreate (instrumentation.java:1047)-15 21:01:21.725:e/androidruntime (32431): at Android.app.ActivityThread.performLaunchActivity (Activitythread.java : 1628)-15 21:01:21.725:e/androidruntime (32431): ... More-15 21:01:21.725:e/androidruntime (32431): caused by:java.lang.ClassNotFoundException: Android.support.v4.view.ViewPager in Loader dalvik.system.pathclassloader[/system/framework/ Com.google.android.maps.jar:/mnt/asec/com.trinea.android.demo-2/pkg.apk]-15 21:01:21.725:e/androidruntime (32431 ): At Dalvik.system.PathClassLoader.findClass (pathclassloader.java:240) -15 21:01:21.725:e/androidruntime (32431): At Java.lang.ClassLoader.loadClass (classloader.java:551) -15 21:01:21.725:e/androidruntime (32431): at Java.lang.ClassLoader.loadClass (classloader.java:511) -15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.createView (layoutinflater.java:471) -15 21:01:21.725:e/androidruntime (32431): at Android.view.LayoutInflater.createViewFromTag (layoutinflater.java:570)
2.java.lang.classnotfoundexception:didn ' t find class "Android.support.v4.view.ViewPager" on path:/data/app/xxx.apk
Solution: put the third-party package (Android-support-v4.jar) in the project directory under the Libs, right-click Project selection: Build Path, use as source folder, OK. The Add jar then adds the Android-support-v4.jar.
Summary: in the case of this problem, the solution is to import the jar package into the project directory, can be placed in the Android private, this is the ADT when loading the project automatically loaded in, you can also directly add the jar itself, note the package duplication problem, This piece is not easy to say clearly, oneself according to the situation to solve.
Additional: Other methods that can be used
1. in the project's properties, in the Java Build path, tick the Android-support-v4.jar in the order and export.
2. Most simple right-click on the project on Android tools to select Fix Project Properties.