microsoft / appcenter-sdk-cordova

App Center Preview SDK for Cordova
http://appcenter.ms
MIT License
50 stars 27 forks source link

error installing app center analytics/crashes #73

Closed jamesdixon closed 5 years ago

jamesdixon commented 5 years ago

Description

Hi, I'm attempting to install App Center Analytics/Crashes and receiving the following error:

$ cordova plugin add cordova-plugin-appcenter-crashes
Installing "cordova-plugin-appcenter-crashes" for android
Installing "cordova-plugin-appcenter-shared" for android
Android Studio project detected
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Installing "cordova-plugin-appcenter-crashes" for ios
Plugin dependency "cordova-plugin-appcenter-shared@0.3.0" already fetched, using that version.
Installing "cordova-plugin-appcenter-shared" for ios
Failed to install 'cordova-plugin-appcenter-shared': Error: pod: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/jamesdixon/Projects/scout/platform/mobile-staff/platforms/ios/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
Failed to install 'cordova-plugin-appcenter-crashes': Error: pod: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/jamesdixon/Projects/scout/platform/mobile-staff/platforms/ios/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

Repro Steps

Please list the steps used to reproduce your issue.

I simply ran cordova plugin add cordova-plugin-appcenter-crashes. I'm also receiving the same error when installing cordova-plugin-appcenter-analytics.

Details

  1. Which SDK version are you using? Attempting to install v0.3.0 of the plugin

  2. What version of Cordova, Cordova platforms, Cocoapods, and Ruby are you using? cordova: 8.1.2 (cordova-lib@8.1.1) cordova-ios: 4.5.4 cordova-android: 7.1.0 cocoapods: 1.5.3 ruby: 2.3.7p456 node: 8.12

  3. What third party plugins are you using?

    com-badrit-base64 0.2.0 "Base64"
    com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
    cordova-android-support-gradle-release 1.4.5 "cordova-android-support-gradle-release"
    cordova-background-geolocation 2.14.5 "BackgroundGeolocation"
    cordova-background-geolocation-lt 2.14.0 "BackgroundGeolocation"
    cordova-plugin-actionsheet 2.3.3 "ActionSheet"
    cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
    cordova-plugin-app-event 1.2.1 "Application Events"
    cordova-plugin-app-version 0.1.9 "AppVersion"
    cordova-plugin-appcenter-analytics 0.3.0 "App Center Analytics for Cordova"
    cordova-plugin-appcenter-shared 0.3.0 "App Center shared code for Cordova"
    cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
    cordova-plugin-camera 4.0.1 "Camera"
    cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
    cordova-plugin-compat 1.2.0 "Compat"
    cordova-plugin-crosswalk-webview 2.4.0 "Crosswalk WebView Engine"
    cordova-plugin-device 2.0.2 "Device"
    cordova-plugin-file 6.0.1 "File"
    cordova-plugin-file-transfer 1.7.1 "File Transfer"
    cordova-plugin-fingerprint-aio 1.3.8 "FingerprintAllInOne"
    cordova-plugin-firebase 0.1.25 "Google Firebase Plugin"
    cordova-plugin-hockeyapp 5.1.2 "HockeyApp"
    cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
    cordova-plugin-nativestorage 2.3.2 "NativeStorage"
    cordova-plugin-splashscreen 5.0.2 "Splashscreen"
    cordova-plugin-statusbar 2.4.2 "StatusBar"
    cordova-plugin-taptic-engine 2.1.0 "Taptic Engine"
    cordova-plugin-telerik-imagepicker 2.2.3 "ImagePicker"
    cordova-plugin-whitelist 1.3.3 "Whitelist"
    cordova-sqlite-storage 2.5.1 "Cordova sqlite storage plugin"
    cordova.plugins.diagnostic 4.0.10 "Diagnostic"
    de.appplant.cordova.plugin.local-notification 0.8.5 "LocalNotification"
    ionic-plugin-keyboard 2.2.1 "Keyboard"
    onesignal-cordova-plugin 2.4.5 "OneSignal Push Notifications"

    I've tried a few other "fixes" from other threads such as running pod setup and also running pod update in the platforms/ios directory, but not having any luck.

Thanks!

jamesdixon commented 5 years ago

Just a heads up that I tried blowing everything away in platforms/, plugins/ and node_modules/ but still getting the same error relating to cordova-plugin-app-center-shared.

jamesdixon commented 5 years ago

One more piece of info:

I'm not a Cocoapods expert by any means so this may be irrelevant, but I ran pod install in the platforms/ios dir and got the following:

$ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "AppCenter":
  In Podfile:
    AppCenter (~> 1.12.0)

Specs satisfying the `AppCenter (~> 1.12.0)` dependency were found, but they required a higher minimum deployment target.
dbpprt commented 5 years ago

I had the same issue, you need to set your deployment target to 9.0. Microsoft dropped iOS 8 support in 0.3.0 which is causing the installation to fail.

annakocheshkova commented 5 years ago

@dennisbappert This is correct.

annakocheshkova commented 5 years ago

@jamesdixon sorry for the issues you are experiencing! We did drop iOS 8 support, as you can see in the changelog. Unfortunately, implementing post-install migration script is not in our roadmap.

Go to platforms > ios, open Podfile and change platform :ios, '8.0' to platform :ios, '9.0'. Then run pod install.

annakocheshkova commented 5 years ago

@jamesdixon By the way, after you do this, please make sure that the plugin is installed correctly and if not, re-install it. All the instructions are described in this comment. Please keep me updated on the progress and let me know if it helps.

Thanks!

dbpprt commented 5 years ago

@jamesdixon

The following solved the issue for me:

<pods-config ios-min-version="9.0" use-frameworks="true">
</pods-config> 

with the following plugin:

<plugin name="cordova-plugin-cocoapod-support" />

It sets the target platform to 9.0 in the Podfile as @annakocheshkova described.

jamesdixon commented 5 years ago

@dennisbappert @annakocheshkova really appreciate the support! Going to give this a try!

Just for my information, I do have this set in my config.xml:

<preference name="deployment-target" value="9.0"/>

Is this the same deployment target we're talking about?

annakocheshkova commented 5 years ago

@jamesdixon yes, but not exactly.

The issue is that the latest version of cordova-ios has a bit of a strange logic where it by default targets ios 9.0, but hardcodes ios 8.0 in the podfile. image image This has been fixed in their repo but not yet released. This is why App Center users experience such issues as well :)

annakocheshkova commented 5 years ago

Anyway let us know if any of suggested fixes help.

jamesdixon commented 5 years ago

Ah! Thank you. That's why I was confused.

I followed your instructions and was able to get it successfully installed. Going to also try @dennisbappert suggestion of using the cocoapods plugin to make sure it's not an issue in the future.

THANK YOU for your help with this and the super-fast response.

Cheers!

jamesdixon commented 5 years ago

@dennisbappert curious if you had to do anything to get the cocoapods plugin to function? I installed it and added the line you recommended, but if I remove iOS as a platform and then re-add it, I get the same appcenter build errors I mentioned above. Checking the Podfile, I still see 8.0 listed.

dbpprt commented 5 years ago

I'm running all my builds on a build server starting from a clean git clone. It doesn't work if you readd the platform. Just clean everything, the entire build folder and start from scratch, then it works fine. @annakocheshkova this was my issue aswell, if you just add deployment-target the Podfile stays incorrect. The mentioned plugin solves this issue.

dbpprt commented 5 years ago

Ah I forgot to mention that you need to install xml2js as a npm dependency, it's required by the plugin.

annakocheshkova commented 5 years ago

@jamesdixon from what I know, this solution won't work on a client project. What this plugin does is it runs a post-install script that just goes through all of the plugins and "grabs" all the pod/framework dependencies. But when attempting to install appcenter plugin, it fails before this script runs.

So I'm guessing you need some strict order of steps in order to achieve this. I'm curios how @dennisbappert got it to work.

P.S. We actually did get it to work on our plugin some time ago but by using a modified script from cocoapods plugin placed in another hook. But implementing this was not on the roadmap so it never got released.

jamesdixon commented 5 years ago

@annakocheshkova @dennisbappert yeah, i'm running this locally (not on a build server) and can't get it to work. I'm hoping an update to cordova-ios is released soon as this is a huge pain if you need to remove/add the platform again, which unfortunately with cordova, is often.

ajincentfit commented 5 years ago

@jamesdixon Try using 'cordova platform add https://github.com/apache/cordova-ios.git#4.5.x' instead of 'cordova platform add ios'. This will use the nightly that has this cocoapod issue fixed

annakocheshkova commented 5 years ago

@ajincentfit that's a good solution actually. We'll take a note of it!

jamesdixon commented 5 years ago

@ajincentfit worked like a charm! Thank you!

troyanskiy commented 5 years ago

Hi all cordova platform add ios@5.0.0 worked for me

annakocheshkova commented 5 years ago

A new release of cordova! Finally.

GreenRidingHood commented 5 years ago

@annakocheshkova

your solution worked for me, thanks

Go to platforms > ios, open Podfile and change platform :ios, '8.0' to platform :ios, '9.0'. Then run pod install.

jackie-d commented 4 years ago

pod repo update

pod update

in ./platforms/ios

(after done everything else specified before)