Ionic2和Facebook登录:安装cordova-plugin-facebook4后模拟Android设备的错误

时间:2016-09-05 18:53:44

标签: android facebook cordova plugins ionic2

我有一个Ionic2应用程序,我希望安装cordova-plugin-facebook4并设置Facebook登录。我已经按照这个here之类的一些教程进行了操作,但是当我尝试模拟android构建时,我遇到了问题。

以下是错误消息:

Error: /Users/mreiter/documents/photor/photor/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find com.android.support:support-v4:23.4.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
         https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
         https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
     Required by:
         :android:unspecified
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
   > Could not find com.android.support:cardview-v7:23.4.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
     Required by:
         :android:unspecified
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
   > Could not find com.android.support:customtabs:23.4.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
         https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
         https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
         https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
         file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
     Required by:
         :android:unspecified
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

对此的任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

今天早上我遇到了这个问题。以下步骤对我有用:

  1. 开始了一个干净的Ionic 2项目
  2. 添加了android平台&按照文档中的描述安装了离子facebook包装器。
  3. 打开Android Studio,从platforms / android /
  4. 导入项目
  5. 让它加载,但当它要求您更新Gradle时,请为此项目选择ignore。
  6. 之后,它会'强烈建议'您更新Gradle,再次忽略它,Android Studio将开始运行您的Gradle并构建一个APK。

    你会发现你可以使用ionic build android,它应该有效。

    除了Android 6.X.X(Marshmallow)之外,我还删除了所有Android SDK。试试看。但仍然不确定问题是什么。