Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install plugin: Cannot read property '0' of undefined #581

Open
ElieSauveterre opened this issue Sep 19, 2019 · 16 comments
Open

Can't install plugin: Cannot read property '0' of undefined #581

ElieSauveterre opened this issue Sep 19, 2019 · 16 comments

Comments

@ElieSauveterre
Copy link

ElieSauveterre commented Sep 19, 2019

Since yesterday (September 18) the plugin install doesn't work, without having changed anything. I have a build pipeline with Gitlab CI. It's using a Docker image with all the dependencies preinstalled (npm, cordova, ionic...). A build that was working 2 days ago, is now failing.

I also have the same error on a blank ionic project (ionic start MyIonicProject tutorial --type=ionic-angular)

My console output:

ionic cordova plugin add branch-cordova-sdk
cordova plugin add branch-cordova-sdk

You have been opted out of telemetry. To change this, run: cordova telemetry on.
Plugin "branch-cordova-sdk" already installed on android.
Adding branch-cordova-sdk to package.json
Cannot read property '0' of undefined
[ERROR] An error occurred while running subprocess cordova.
cordova plugin add branch-cordova-sdk exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.

I'm using:

  • node 8.15.0
  • npm 6.7.0
  • ionic 5.2.3
  • cordova 8.1.2

I also tried with

  • node 8.15.0
  • npm 6.11.3
  • ionic 5.3.0
  • cordova 9.0.0
@ronkot
Copy link

ronkot commented Sep 19, 2019

I encountered the same problem. A week ago build was working but now cordova platform add android fails. Here's the error when running the command in verbose mode:

TypeError: Cannot read property '0' of undefined
    at getManifest (/Users/me/projects/project/project-cordova-deploy/project-web/plugins/branch-cordova-sdk/src/scripts/android/updateAndroidManifest.js:75:36)
    at Object.writePreferences (/Users/me/projects/project/project-cordova-deploy/project-web/plugins/branch-cordova-sdk/src/scripts/android/updateAndroidManifest.js:15:22)
    at platforms.forEach.platform (/Users/me/projects/project/project-cordova-deploy/project-web/plugins/branch-cordova-sdk/src/scripts/hooks/afterPrepare.js:20:25)
    at Array.forEach (<anonymous>)
    at run (/Users/me/projects/project/project-cordova-deploy/project-web/plugins/branch-cordova-sdk/src/scripts/hooks/afterPrepare.js:18:15)
    at runScriptViaModuleLoader (/Users/me/.nvm/versions/node/v10.15.3/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:196:18)
    at runScript (/Users/me/.nvm/versions/node/v10.15.3/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:172:16)
    at /Users/me/.nvm/versions/node/v10.15.3/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:140:20
    at _fulfilled (/Users/me/.nvm/versions/node/v10.15.3/lib/node_modules/cordova/node_modules/q/q.js:854:54)
    at /Users/me/.nvm/versions/node/v10.15.3/lib/node_modules/cordova/node_modules/q/q.js:883:30```

@psnfrench
Copy link

This seems to be an issue with cordova-android 8.1.0. It doesn't seem to add the same records to AndroidManifest.xml that is used to and hence the branch-cordova-sdk cannot get the uses-sdk tag and determine the target sdk version.

When I specify the android version explicitly to an earlier version the problem no longer occurs i.e:

ionic cordova platform add [email protected]

@yadhukrishnas
Copy link

yadhukrishnas commented Sep 23, 2019

I encountered the same error. 4 days back every thing is working but now 'ionic cordova platform add android' fails .

@deliverymanager
Copy link

deliverymanager commented Sep 25, 2019

In my case I get the same error when adding the plugin.
Also, there are other plugins that this happens too.

Ionic:

Ionic CLI : 5.4.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.3.4
@ionic/v1-toolkit : 1.0.13

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.2.0-dev
Cordova Plugins : cordova-plugin-ionic 5.4.4, cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 12 other plugins)

Utility:

cordova-res : 0.6.0
native-run : not installed

System:

Android SDK Tools : 26.1.1 (/Users/adomvris/Library/Android/sdk/)
ios-deploy : 1.9.2
NodeJS : v9.10.1 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS Mojave
Xcode : Xcode 11.0 Build version 11A420a

@deliverymanager
Copy link

Here is the error:

Screenshot 2019-09-25 14 52 48

@noahcooper
Copy link

Any update from the Branch team?

@undersieg
Copy link

uses-sdk should no longer be declared in the manifest, please check apache/cordova-android#629

@Leo1305Pineda
Copy link

In the version npm i branch-cordova-sdk@^4.0.0 be omit the requese targetVersionSdk use this version

@noahcooper
Copy link

In the version npm i branch-cordova-sdk@^4.0.0 be omit the requese targetVersionSdk use this version

Just keep in mind that the tradeoff is that as of version 4.0.0, you have to manually build from Xcode. #601

@epetre
Copy link

epetre commented Dec 2, 2019

Any update from the Branch team?

Any news?

@tryhardest
Copy link

Is this being worked on?

@noahcooper
Copy link

Is this being worked on?

This is fixed in version 4.0.0, and now works properly with cordova-android 8.1.0. The problem is that version 4.0.0 introduces a change for iOS that makes it so that you cannot build from the command line and now have to build directly in Xcode. Super annoying, as it means that you're forced to choose to use a version that works with Android, or use a different version that works with iOS.

@Mapiac
Copy link

Mapiac commented Jan 15, 2020

@noahcooper did you find a work around? Or @adrianyg7 and way to get around this iOS bug on 4.0.0?

@codinronan
Copy link
Contributor

@noahcooper @Mapiac you should be able to use 3.2.1 which is now published, which fixes the issue for cordova-android in the branch plugin's 3.x line.

If you're using cordova 8/9 and build using xcode, you'll want to use the 4.0 line. We know about the inability to build on the command line, it's an issue the iOS team will take on at some point but requires significant reorganization of the native library so will take some time.

@codinronan
Copy link
Contributor

@echo-branch would it make sense to close this issue now?

@noahcooper
Copy link

Version 3.2.1 works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests