Intereting Posts
   

无法向android项目添加兼容包

我在将兼容性软件包添加到我的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 

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

  1. 从菜单中选择Project – > Properties
  2. 选择“Java Build Path”
  3. 转到“库”选项卡,然后选择“添加库”
  4. 选择“用户库”
  5. 选择“用户库”
  6. 选择“新”
  7. 为您的图书馆命名,例如“Android-Compatibility-v4”
  8. 在左窗格中创建后,按Add JARS
  9. 选择兼容性jar,如D:\ Programs \ android-sdk-windows \ extras \ android \ support \ v4 \ android-support-v4.jar
  10. 您将返回“用户库”窗格。 选择“确定”。 您将看到添加了此新用户库并选中了checkbox。 按“完成”。 按“确定”

您的项目现在应该在构建路径中添加兼容性jar。 注意。 按“Android工具” – >“添加兼容性库 ”仍然无效,但至少您的项目现在包含所需的库,您可以工作。

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

我在SDK中遗漏了这个神秘的“extras”文件夹,所以我无法做Developerx的解决方案。

获得它的方法是:

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

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

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

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

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

在Mac上的Eclipse下,我做到了

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

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

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

不要被版本控制混淆,它与android版本不对应。 Extra追随他们自己的版本。 只需拿起最新的,你应该没事。

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

这在Windows上对我有用:

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

2.复制jar子。

3.创建v4文件夹,其中错误消息显示无法findjar。 例如,如果错误消息是

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

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

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

5.单击Eclipse中的Android工具>添加兼容性jar。