About the Android-support-v4.jar package error

Source: Internet
Author: User

1. add android-support-v4 error Java.lang.ClassNotFoundException:android.support.v4.view.ViewPager In Loade

problem: after using Viewpager to add Android-support-v4.jar after the demo sample such as the following error

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 joined the Android-support-v4.jar package through the Add External jars, Java Build Path, Project---Properties. To solve the jar that requires only the Java Build Path----Properties----Copy the jar package directly to the project's Libs folder. Because the jar package under Project Libs will import the project on its own initiative. Manual import is not required. The packages that you actively import are present in 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

Workaround: put the third party package (Android-support-v4.jar) in the project folder under the Libs, right-click the project selection: Build Path, use as source folder, OK.

The Add jar will then add the Android-support-v4.jar to it.


Summary: in the case of this problem, the solution is to import the jar package into the project folder, can be placed in the Android private, this is the ADT when loading the project itself in the active load, but also can directly add the jar to join in, Note the recurring problem with the package. 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.

About the Android-support-v4.jar package error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.