Problems with using Android compatible package android-support-v4.jar

Source: Internet
Author: User

Project needs to use viewpager, do not hesitate to introduce the official android-support-v4.jar

The development process is not surprising. Two problems occurred during signature packaging.

1. An error occurred while exporting the signature APK using eclipse.

[2011-11-03 16:07:52 - AndroidViewPager] Proguard returned with error code 1. See console[2011-11-03 16:07:52 - AndroidViewPager] Note: there were 95 duplicate class definitions.[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find superclass or interface android.os.Parcelable$ClassLoaderCreator[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.app.ActivityCompatHoneycomb: can't find referenced method 'void invalidateOptionsMenu()' in class android.app.Activity[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.app.ActivityCompatHoneycomb: can't find referenced method 'void dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])' in class android.app.Activity[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2: can't find referenced class android.os.Parcelable$ClassLoaderCreator[2011-11-03 16:07:52 - AndroidViewPager] Warning: android.support.v4.view.MenuCompatHoneycomb: can't find referenced method 'void setShowAsAction(int)' in class android.view.MenuItem[2011-11-03 16:07:52 - AndroidViewPager] Warning: there were 3 unresolved references to classes or interfaces.[2011-11-03 16:07:52 - AndroidViewPager]          You may need to specify additional library jars (using '-libraryjars'),[2011-11-03 16:07:52 - AndroidViewPager]          or perhaps the '-dontskipnonpubliclibraryclasses' option.[2011-11-03 16:07:52 - AndroidViewPager] Warning: there were 3 unresolved references to program class members.[2011-11-03 16:07:52 - AndroidViewPager]          Your input classes appear to be inconsistent.[2011-11-03 16:07:52 - AndroidViewPager]          You may need to recompile them and try again.[2011-11-03 16:07:52 - AndroidViewPager]          Alternatively, you may have to specify the options [2011-11-03 16:07:52 - AndroidViewPager]          '-dontskipnonpubliclibraryclasses' and/or[2011-11-03 16:07:52 - AndroidViewPager]          '-dontskipnonpubliclibraryclassmembers'.[2011-11-03 16:07:52 - AndroidViewPager] java.io.IOException: Please correct the above warnings first.[2011-11-03 16:07:52 - AndroidViewPager]    at proguard.Initializer.execute(Initializer.java:308) [2011-11-03 16:07:52 - AndroidViewPager]    at proguard.ProGuard.initialize(ProGuard.java:210)[2011-11-03 16:07:52 - AndroidViewPager]    at proguard.ProGuard.execute(ProGuard.java:85)[2011-11-03 16:07:52 - AndroidViewPager]    at proguard.ProGuard.main(ProGuard.java:499)

Cause:

Android Compatibility library referencing classes that only exist in recent versions of the Android API

Solution: in the project's proguard. cfg file, add

 
-dontwarn **HoneycombMR2-dontwarn **CompatICS-dontwarn **Honeycomb-dontwarn **CompatIcs*-dontwarn **CompatFroyo-dontwarn **CompatGingerbread

The specific dontwarn entries can be modified based on the error.


2. the APK generated using the command line script cannot be run, when running to a class related to the android-support-v4.jar, classnotfoundexception appears
Work und: when running the DX command, add the android-support-v4.jar to class. Dex

%DX% --dex --output=%OUT_FOLDER%\classes.dex %OUT_CLASS_FOLDER% %THIRD_JAR%

Reference

  1. Http://stackoverflow.com/questions/7993608/i-am-getting-error-while-export-my-android-application-from-eclipse-which-use-an
  2. Http://snmoney.blog.163.com/blog/static/440058201181011468397/


 
 
 
 
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.