android - JAR 不匹配!修复使用两个库时的依赖错误

标签 android jar android-support-library

我创建了一个应用程序,需要使用两个不同的 Android 支持库,因为我使用的方法在一个库中不可用。我使用的一个库是用于滑动菜单的 ABS,第二个是ActionBarSherelock 两者都使用不同的 android 支持库。当我在项目中使用两者时,我收到此错误。

日志猫:

Found 2 versions of android-support-v4.jar in the dependency list,
        \[2014-01-13 11:26:17 - phoneCall\] but not all the versions are identical (check is based on SHA-1 only at this time).
        \[2014-01-13 11:26:17 - phoneCall\] All versions of the libraries must be the same at this time.
        \[2014-01-13 11:26:17 - phoneCall\] Versions found are:
        \[2014-01-13 11:26:17 - phoneCall\] Path: /root/AndroidHome/AndroidWorkspace/ActionBarSherlock/libs/android-support-v4.jar
        \[2014-01-13 11:26:17 - phoneCall\]     Length: 385685
        \[2014-01-13 11:26:17 - phonecall\]     SHA-1: 48c94ae70fa65718b382098237806a5909bb096e
        \[2014-01-13 11:26:17 - phone91\] Path: /root/AndroidHome/AndroidWorkspace/ABS/libs/android-support-v4.jar
        \[2014-01-13 11:26:17 - phoneCall\]     Length: 484258
        \[2014-01-13 11:26:17 - phoneCall\]     SHA-1: bd6479f5dd592790607e0504e66e0f31c2b4d308
        \[2014-01-13 11:26:17 - phoneCall\] Jar mismatch! Fix your dependencies

我已提及this解决方案并尝试解决,但在 mainactivity 上显示错误

 import android.support.v4.app.ActionBarDrawerToggle;
 import android.support.v4.view.GravityCompat;
 import android.support.v4.widget.DrawerLayout

请告诉我如何解决这个问题。

最佳答案

确保应用程序中的 android-support-v4.jarActionBarSherlock 应用程序中的内容相同,因此请从 ABS 库复制 android-support-v4.jar并在您的项目中使用它。

按照以下步骤操作,

  1. 转到 ABS 项目的 lib 文件夹并复制 android-support-v4.jar 文件
  2. 将 .jar 文件粘贴到当前项目中
  3. 清理并刷新项目

关于android - JAR 不匹配!修复使用两个库时的依赖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21084983/

相关文章:

android - 使用 Holo-Light 主题不会为 TextView 设置正确的颜色

java - "Complete action using"尝试在 WebView 中加载时

android - 伴奏 systemUiController darkIcons 在 Android 11 上不起作用

android - 如何使用通用图像加载器在 Intent 服务(后台线程)中缓存图像

intellij-idea - IntelliJ Spring Boot : How to create an executable jar

android - 在 StaggeredGridLayoutManager 中设置单行的跨度大小

android - 受信任的 Web Activity - 地址栏不隐藏(Chrome for Android 72)

java - 在 Eclipse 中添加外部 jar

java - JAR 文件的远程更新

android - 在空白 Xamarin.Forms 应用程序中生成错误