无法向android项目添加兼容包

时间:2011-11-12 06:51:42

标签: android compatibility

我无法将兼容包添加到我的android项目中。

不确定该如何处理。 任何想法都表示赞赏。错误发生在底部,似乎与我的localhost的连接被拒绝。

这是我看到的控制台输出:

[2011-11-12 01:44:13 - SDK Manager] Fetching https://dl-ssl.google.com/android/repository/addons_list-1.xml
[2011-11-12 01:44:14 - SDK Manager] Validate XML
[2011-11-12 01:44:14 - SDK Manager] Parse XML
[2011-11-12 01:44:14 - SDK Manager] Fetched Add-ons List successfully
[2011-11-12 01:44:14 - SDK Manager] Fetching URL: https://dl-ssl.google.com/android/repository/repository-5.xml
[2011-11-12 01:44:15 - SDK Manager] Validate XML: https://dl-ssl.google.com/android/repository/repository-5.xml
[2011-11-12 01:44:15 - SDK Manager] Parse XML:    https://dl-ssl.google.com/android/repository/repository-5.xml
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 1.1, API 2, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 1.5, API 3, revision 4
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 1.6, API 4, revision 3
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.0, API 5, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.0.1, API 6, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.1, API 7, revision 3
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.2, API 8, revision 3
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.3.1, API 9, revision 2 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 2.3.3, API 10, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 3.0, API 11, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 3.1, API 12, revision 3
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 3.2, API 13, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found SDK Platform Android 4.0, API 14, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found ARM EABI v7a System Image, Android API 14, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 7, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 8, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 9, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 10, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 11, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 12, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 13, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Samples for SDK API 14, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Android SDK Platform-tools, revision 9
[2011-11-12 01:44:15 - SDK Manager]     Found Android SDK Tools, revision 15
[2011-11-12 01:44:15 - SDK Manager]     Found Documentation for Android SDK, API 14, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Android Support package, revision 4
[2011-11-12 01:44:15 - SDK Manager] Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
[2011-11-12 01:44:15 - SDK Manager] Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
[2011-11-12 01:44:15 - SDK Manager] Parse XML:    https://dl-ssl.google.com/android/repository/addon.xml
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 3, revision 3
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 4, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 5, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 6, revision 1 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 7, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 8, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 9, revision 2 (Obsolete)
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 10, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 11, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 12, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 13, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google APIs by Google Inc., Android API 14, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google TV Addon by Google Inc., Android API 12, revision 2
[2011-11-12 01:44:15 - SDK Manager]     Found Google Market Licensing package, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google USB Driver package, revision 4
[2011-11-12 01:44:15 - SDK Manager]     Found Google Market Billing package, revision 1
[2011-11-12 01:44:15 - SDK Manager]     Found Google Admob Ads Sdk package, revision 4
[2011-11-12 01:44:15 - SDK Manager]     Found Google Webdriver package, revision 2
[2011-11-12 01:44:15 - SDK Manager] Fetching URL: http://www.echobykyocera.com/download/echo_repository.xml
[2011-11-12 01:44:15 - SDK Manager]   Failed to fetch URL http://www.echobykyocera.com/download/echo_repository.xml/addon.xml, reason: Connection to http://127.0.0.1:8888 refused
[2011-11-12 01:44:15 - SDK Manager] Fetching URL: http://developer.lgmobile.com/sdk/android/repository.xml
[2011-11-12 01:44:15 - SDK Manager]   Failed to fetch URL http://developer.lgmobile.com/sdk/android/repository.xml/addon.xml, reason: Connection to http://127.0.0.1:8888 refused
[2011-11-12 01:44:15 - SDK Manager] Fetching URL: http://innovator.samsungmobile.com/android/repository/repository.xml
[2011-11-12 01:44:15 - SDK Manager]   Failed to fetch URL http://innovator.samsungmobile.com/android/repository/repository.xml/addon.xml, reason: Connection to http://127.0.0.1:8888 refused
[2011-11-12 01:44:15 - SDK Manager] Fetching URL: http://developer.sonyericsson.com/edk/android/repository.xml
[2011-11-12 01:44:16 - SDK Manager]   Failed to fetch URL http://developer.sonyericsson.com/edk/android/repository.xml/addon.xml, reason: Connection to http://127.0.0.1:8888 refused
[2011-11-12 01:44:16 - SDK Manager] Done loading packages.
[2011-11-12 01:44:16 - Android Compatibility JAR not found:] /apps/eclipse64/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar

7 个答案:

答案 0 :(得分:17)

在Eclipse中,您可以创建一个"用户库",添加您需要的兼容性jar(v4或v13),并在构建路径中添加此用户库。下面是一个简短的步骤计划:

  1. 从菜单中选择项目 - >特性
  2. 选择" Java Build Path"
  3. 转到"图书馆"选项卡,然后选择"添加库"
  4. 选择"用户库"
  5. 选择"用户库"
  6. 选择"新"
  7. 为您的图书馆命名,例如" Android-Compatibility-v4"
  8. 在左窗格中创建后,按添加JARS
  9. 选择兼容性jar,例如 D:\ Programs \ android-sdk-windows \ extras \ android \ support \ v4 \ android-support-v4.jar
  10. 您将返回“用户库”窗格。选择"确定"。您将看到添加了此新用户库并选中了复选框。按"完成"。按"确定"
  11. 您的项目现在应该在构建路径中添加了兼容性jar。 注意。按" Android工具" - > "添加兼容性库"仍然不起作用,但至少你的项目现在包括所需的库,你可以工作。

    第二个选项是创建一个Lib并在其中添加jar:http://developer.android.com/sdk/compatibility-library.html(设置项目以使用库)

答案 1 :(得分:6)

我在SDK中遗漏了这个神秘的“extras”文件夹,因此我无法使用Developerx的解决方案。

获得它的方法是:

  1. 在< sdk> / tools /文件夹中运行“android”程序。这将打开“Android SDK Manager”。
  2. 在屏幕底部附近,展开“Extras”文件夹,然后选中“Android Support Package”复选框。
  3. 点击“Install 1. package ..”,完成后你应该拥有包含“android-support-v4.jar”的“extras”文件夹。

答案 2 :(得分:4)

对于记录,这似乎是ADT中的已知问题:http://code.google.com/p/android/issues/detail?id=21488

答案 3 :(得分:1)

从android sdk文件夹中获取兼容性jar文件。它应该在

E:\Softwares\Android\android-compatibility\v4

取决于您安装sdk的位置。 将该jar放在项目的lib文件夹中。在日食中,参考罐子。

答案 4 :(得分:1)

在Mac上的Eclipse下,我做了

  

Windows-> SDK Manager->按API级别排序 - > ScrollDown到Extras->展开Extras->“Android支持库

他们已将兼容性移至Android Support Library

版本13将片段类添加到Android 2.3.3

不要对版本控制感到困惑,它与android版本不对应。 Extra追随他们自己的版本。拿起最新的,你应该没问题。

答案 5 :(得分:0)

C:\ Program Files(x86)\ Android \ android-sdk \ extras \ android \ support \ v4 对于Windows 7的问题

答案 6 :(得分:0)

这适用于Windows:

1。 找到兼容性jar:android-sdk-windows \ extras \ android \ support \ v4 \ android-support-v4.jar。

2。 复制罐子。

3。 创建v4文件夹,其中错误消息显示它无法找到jar。例如,如果错误消息是

"Android Compatibility JAR not found:] C:\eclipse\eclipse\v4\android-support-v4.jar" 

然后如果没有该名称的文件夹,则创建v4文件夹。

4。 将jar粘贴到v4文件夹中。

5。 点击Android工具>在Eclipse中添加兼容性jar。