Ionic cordova run error


#1

Hello, I have an Ionic 3 app, and it was working ok. But after installing facebook plugin , I can’t run it on Android device.

Running: ionic cordova run android --consolelogs --livereload --stacktrace --info it throws:

FAILURE: Build failed with an exception.
  • What went wrong:
    A problem occurred configuring root project ‘android’.

Could not resolve all dependencies for configuration ‘:_debugApkCopy’.
Could not find com.android.support:support-v4:27.0.1.
Searched in the following locations:
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
Required by:
project :
Could not find com.android.support:support-annotations:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom
file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
file:/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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
Could not find com.android.support:support-core-utils:27.0.1.
Searched in the following locations:

     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
 Required by:
     project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0

Could not find com.android.support:appcompat-v7:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
file:/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
 Required by:
     project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

Could not find com.android.support:cardview-v7:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom
file:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
file:/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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
Could not find com.android.support:customtabs:27.0.1.

 Searched in the following locations:

     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
 Required by:
     project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

Could not find com.android.support:support-v4:27.0.1.
Searched in the following locations:

     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
 Required by:
     project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 13.358 secs
Error: /home/ivan/dev/RedSocial/gilfoyle/mobile/app/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 ‘:_debugApkCopy’.
Could not find com.android.support:support-v4:27.0.1.
Searched in the following locations:
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
Required by:
project :
Could not find com.android.support:support-annotations:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom
file:/home/ivan/Android/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
file:/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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
Could not find com.android.support:support-core-utils:27.0.1.
Searched in the following locations:
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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
Could not find com.android.support:appcompat-v7:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
file:/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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
Could not find com.android.support:cardview-v7:27.0.1.
Searched in the following locations:
file:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom
file:/home/ivan/Android/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
file:/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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
Could not find com.android.support:customtabs:27.0.1.
Searched in the following locations:
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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
Could not find com.android.support:support-v4:27.0.1.
Searched in the following locations:
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
Required by:
project : > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

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

[ERROR] An error occurred while running cordova run android (exit code 1).

EDIT:
This is my 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"
    ]
}

}

Output of ionic info:

cli packages: (/usr/lib/node_modules)

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

global packages:

Cordova CLI : 7.0.1 

local packages:

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

System:

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

Thank’s in advance.


#2

I solved it with:

cordova plugin rm cordova-plugin-facebook4

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

I had to downgrade the version.

Font: https://forums.adobe.com/thread/2422093