Ionic 3 cordova facebook原生插件在构建时出错

时间:2018-02-07 04:00:00

标签: cordova ionic2 cordova-plugins ionic3 cordova-facebook

当我尝试构建具有facebook原生插件的离子项目时出现此错误。

Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.android.support:customtabs:27.0.2.


Searched in the following locations:
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.pom
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
         file:/Users/MacBook/Documents/MJMobile/giftin-app/platforms/android/sdk-manager/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-core-utils:27.0.2.
     Searched in the following locations:
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.pom
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
         file:/Users/MacBook/Documents/MJMobile/giftin-app/platforms/android/sdk-manager/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-v4:27.0.2.
     Searched in the following locations:
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.pom
         file:/Users/MacBook/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
         file:/Users/MacBook/Documents/MJMobile/giftin-app/platforms/android/sdk-manager/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar

我在github,SO和许多其他论坛上阅读了此错误的其他解决方案。 我尝试了所有这些解决方案,如下面的

1.替换build.gradle文件中的mavenCentral()。

2.重新安装android支持存储库。

3.re将android平台添加到离子项目中

但是没有解决这个问题。有没有解决方案/推荐?

谢谢。

1 个答案:

答案 0 :(得分:4)

最后我找到了解决方案。

这就是我所做的。

我使用的是cordova平台android 6.2.2。首先我将其更新为android 6.3.0

cordova platform update android@6.3.0

然后我收到以下错误

Error:Execution failed for task':app:transformClassesWithDexForDebug'.

然后我从我的Ionic项目中删除了cordova android平台。然后我添加了android 6.3.0

cordova platform add android@6.3.0

然后修复了我的错误并成功构建了项目。

谢谢。