添加 PhoneGap Build Android 要求

Adding PhoneGap Build Android requirements

所以我升级了我的 facebookConnectPlugin (cordova-plugin-facebook4/npmjs) 以获得 iOS 支持,我的 iOS 构建现在正在编译 - 但现在我的 Android 不是。构建错误状态:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'project'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find com.android.support:support-v4:23.2.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.0/support-v4-23.2.0.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.0/support-v4-23.2.0.jar
         file:/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.2.0/support-v4-23.2.0.pom
         file:/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.2.0/support-v4-23.2.0.jar
         file:/android-sdk/extras/google/m2repository/com/android/support/support-v4/23.2.0/support-v4-23.2.0.pom
         file:/android-sdk/extras/google/m2repository/com/android/support/support-v4/23.2.0/support-v4-23.2.0.jar
     Required by:
         :project:unspecified > com.facebook.android:facebook-android-sdk:4.10.1
   > Could not find com.android.support:cardview-v7:23.2.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.pom
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.jar
         file:/android-sdk/extras/android/m2repository/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.pom
         file:/android-sdk/extras/android/m2repository/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.jar
         file:/android-sdk/extras/google/m2repository/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.pom
         file:/android-sdk/extras/google/m2repository/com/android/support/cardview-v7/23.2.0/cardview-v7-23.2.0.jar
     Required by:
         :project:unspecified > com.facebook.android:facebook-android-sdk:4.10.1

这在他们的 issues list of this repository (opened 22 days ago), with a pull request 中有所描述,解释了他们的修复(2 天前)。

我使用的是 6.0.0 的 CLI 版本。任何人都可以建议我可以尝试的其他方法吗?

编辑:我只升级到 cli 6.0.0,因为我看到它是最近发布的,并且认为它可能具有所需的依赖项 - 我稍后会尝试 5.4 和 5.2。

编辑:关于你的问题,杰西;

  1. 这是您的第一个混合应用程序吗?是
  2. 您使用的是桌面应用程序吗?否
  3. 您的目标平台是什么,它们的目标版本是:Android 4、5、6? iOS7,8,9? Android 4.4+(用于 websocket 支持),iOS 7+
  4. 您使用的是 CLI、SDK 还是 Build?构建 - 即确认我通过 build.phonegap.com.
  5. 完成所有操作
  6. 您是否尝试过与插件作者进行沟通?不,但这绝对是我接下来要做的。

我从昨天开始就遇到了同样的问题。我的解决方案是通过 SDK 管理器更新 Android 支持库(提示:运行 作为管理员,否则它不会为我更新任何东西。)

我也在用Phonegap Build

显然问题出在 phonegap 构建而不是插件,因为提到的 Android 支持库尚未更新。

我在插件 issues page 中找到的一个解决方案是将插件降级为使用 1.3.0 版:

<gap:plugin name="cordova-plugin-facebook4" source="npm" version="1.3.0">
  <param name="APP_ID" value="APP_ID" />
  <param name="APP_NAME" value="APP_NAME" />
</gap:plugin>

同时排除或注释掉它,因为它会产生另一种类型的编译错误:

<gap:plugin name="cordova-plugin-android-support-v4" gap:platform="android" source="npm" spec="21.0.1" />

这对我有用,现在我的 Android 构建工作了。

Phonegap Build 更新该库之前的临时解决方案。