Ionic 3 cordova运行错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ionic 3 cordova运行错误相关的知识,希望对你有一定的参考价值。

我有一个Ionic 3应用程序,它运行正常。但在安装facebook plugin之后,我无法在android设备上运行它。

跑:ionic cordova run android --consolelogs --livereload --stacktrace --info它抛出:

FAILURE: Build failed with an exception.
  • 出了什么问题:配置根项目'android'时出现问题。 无法解析配置':_debugApkCopy'的所有依赖项。找不到com.android.support:support-v4:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar必需:project:找不到com.android.support:support-annotations:27.0。 1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar必需:project:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-core:4.29.0找不到com.android.support:support-core-utils:27.0.1。在以下位置搜索: file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar file:/home/ivan/dev/RedSocial/gilfoyle/mobile/app/platforms/android/sdk-manager/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar 要求:项目:> com.facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-core:4.29.0 找不到com.android.support:appcompat-v7:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar file:/home/ivan/dev/RedSocial/gilfoyle/mobile/app/platforms/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar 要求:项目:> com.facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-common:4.29.0 找不到com.android.support:cardview-v7:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar要求:项目:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-common:4.29.0找不到com.android.support:customtabs:27.0.1。 在以下位置搜索: file:/home/ivan/Android/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.pom file:/home/ivan/Android/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar file:/home/ivan/dev/RedSocial/gilfoyle/mobile/app/platforms/android/sdk-manager/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar 要求:项目:> com.facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-common:4.29.0 找不到com.android.support:support-v4:27.0.1。在以下位置搜索: file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar file:/home/ivan/dev/RedSocial/gilfoyle/mobile/app/platforms/android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar 要求:项目:> com.facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-common:4.29.0
  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

建筑失败

总时间:13.358秒错误:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms / android / gradlew:命令失败,退出代码1错误输出:FAILURE:构建失败,异常。

  • 出了什么问题:配置根项目'android'时出现问题。 无法解析配置':_debugApkCopy'的所有依赖项。找不到com.android.support:support-v4:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar必需:project:找不到com.android.support:support-annotations:27.0。 1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar必需:project:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-core:4.29.0找不到com.android.support:support-core-utils:27.0.1。在以下位置搜索:file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom文件: /home/ivan/Android/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar文件:/ home / ivan / dev / RedSocial /gilfoyle/mobile/app/platforms/android/sdk-manager/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar必需:project:> com。 facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-core:4.29.0找不到com.android.support:appcompat-v7:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar必需:project:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-common:4.29.0找不到com.android.support:cardview-v7:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar要求:项目:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-common:4.29.0找不到com.android.support:customtabs:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.pom文件:/ home / ivan / Android / extras /android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms / android / sdk-manager / com /android/support/customtabs/27.0.1/customtabs-27.0.1.jar必需:project:> com.facebook.android:facebook-android-sdk:4.29.0> com.facebook.android:facebook-common: 4.29.0找不到com.android.support:support-v4:27.0.1。在以下位置搜索:文件:/home/ivan/Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom文件:/ home / ivan /Android/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar文件:/ home / ivan / dev / RedSocial / gilfoyle / mobile / app / platforms /android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar必需:project:> com.facebook.android:facebook-android-sdk:4.29。 0> com.facebook.android:facebook-common:4.29.0
  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

[错误]运行cordova run android时出错(退出代码1)。

编辑:这是我的package.json


"name": "socialPhotoCompetition",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": 
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
,
"dependencies": 
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/camera": "^4.2.1",
    "@ionic-native/core": "3.10.2",
    "@ionic-native/date-picker": "^4.3.2",
    "@ionic-native/facebook": "^3.10.3",
    "@ionic-native/http": "^4.3.3",
    "@ionic-native/native-storage": "^4.1.0",
    "@ionic-native/screen-orientation": "^3.12.1",
    "@ionic-native/splash-screen": "3.10.2",
    "@ionic-native/status-bar": "3.10.2",
    "@ionic/storage": "^2.0.1",
    "cordova-android": "^6.2.3",
    "cordova-plugin-advanced-http": "^1.7.1",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-console": "^1.1.0",
    "cordova-plugin-datepicker": "^0.9.3",
    "cordova-plugin-device": "^1.1.6",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-screen-orientation": "^2.0.1",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.2.3",
    "cordova-plugin-whitelist": "^1.3.2",
    "cordova-sqlite-storage": "^2.0.4",
    "es6-promise-plugin": "git+https://github.com/vstirbu/PromisesPlugin.git",
    "ionic-angular": "3.5.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "jquery": "^3.2.1",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
,
"devDependencies": 
    "@ionic/app-scripts": "2.0.2",
    "@ionic/cli-plugin-cordova": "1.5.0",
    "@ionic/cli-plugin-ionic-angular": "1.4.0",
    "typescript": "2.3.4"
,
"description": "An Ionic project",
"cordova": 
    "plugins": 
        "cordova-plugin-console": ,
        "cordova-plugin-device": ,
        "cordova-plugin-splashscreen": ,
        "cordova-plugin-statusbar": ,
        "cordova-plugin-whitelist": ,
        "ionic-plugin-keyboard": ,
        "cordova-plugin-screen-orientation": ,
        "cordova-sqlite-storage": ,
        "cordova-plugin-camera": ,
        "cordova-plugin-datepicker": ,
        "cordova-plugin-advanced-http": ,
        "cordova-plugin-facebook4": 
            "APP_ID": "1690550351252019",
            "APP_NAME": "gilfoyle"
        
    ,
    "platforms": [
        "android"
    ]

ionic info的输出:

cli packages: (/usr/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

全球套餐:

Cordova CLI : 7.0.1 

本地包裹:

@ionic/app-scripts : 2.0.2
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.2

系统:

Android SDK Tools : 26.0.2
Node              : v6.12.2
npm               : 3.10.10 
OS                : Linux 4.4

提前致谢。

答案

我解决了它:

cordova plugin rm cordova-plugin-facebook4

ionic cordova plugin add cordova-plugin-facebook4@1.7.4 --variable APP_ID= --variable APP_NAME=

我不得不降级版本。

字体:https://forums.adobe.com/thread/2422093

以上是关于Ionic 3 cordova运行错误的主要内容,如果未能解决你的问题,请参考以下文章

Ionic 3 错误:“文件 google-services.json 丢失。没有它,Google 服务插件无法运行。”在 ionic cordova 构建/准备 android

Ionic 2 运行时错误:Cordova 未定义

使用 --livereload 标志运行 ionic cordova 项目错误

Ionic 3 cordova 遇到设备/模拟器错误 [Android]

运行“ionic cordova platform add ios”时出错

错误:尝试运行 ionic cordova run android 时出现未知标志“p”