Using ActionBarSherlock & ViewPagerIndicator Synchronously Will Not Compile

后端 未结 2 960
眼角桃花
眼角桃花 2021-01-05 15:30

When using ActionBarSherlock and ViewPagerIndicator at the same time I am getting the below error; from what I\'ve read - it\'s caused due to conflicting/duplicate libraries

相关标签:
2条回答
  • 2021-01-05 15:54

    I'm on the latest version of ADT, SDK etc and it still has this problem - it still doesn't seem to know which support library to use from which dependent library etc.

    TJ's solution does work but I used an alternate approach.

    My solution was the following:

    1. Went into each library project and main application project that references the library and deleted the libs/android-support-v4.jar reference
    2. Went back into each project and dragged the android-support-v4.jar from the filesystem (on my Mac, I store the SDK in my documents folder: Users//Documents/Android/android-sdk-mac_x86/extras/android/compatibility/v4/android-support-v4.jar) onto the libs folder and choose to LINK to the jar instead of copying it into the project.
    3. Now all my projects reference the same .jar file on my filesystem and if I update the support library in the future (via the Android SDK Manager), the .jar will be updated and the projects in turn will pull in the latest jar.

    So updating the support library should not break anything and allow you to be on the latest version.

    0 讨论(0)
  • 2021-01-05 16:10

    Yes, the problem is both ActionBarSherlock and ViewPagerIndicator use libs/android-support-v4.jar dependency.

    The simplest solution is upgrade your work station to latest Android SDK and Eclipse ADT plugin version (at least r17), as this situation is automatically handled by the SDK now (since r17), see the r17 changelog:

    Dependency resolution

    When a project references two Library projects that both require the same jar file, the build system has to detect and resolve the duplication.

    Also Note that since r17, all jar file under libs folder are automatically populated to project's classpath, you don't need manually add them to project's build path anymore, also mentioned in the r17 changelog:

    Projects have source folders, as well as Library Project and jar file dependencies. With no other setup needed than adding Library Projects as a dependency in project.properties, a project’s classpath is automatically populated with:

    • The content of the project’s libs/*.jar
    • The output of the Library Projects.
    • The Library Projects’ libs/*.jar

    Hope this helps.

    0 讨论(0)
提交回复
热议问题