cordova-ionic-phonegap-branch-deep-linking-attribution
cordova-ionic-phonegap-branch-deep-linking-attribution copied to clipboard
Can't install plugin: Cannot read property '0' of undefined
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
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```
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]
I encountered the same error. 4 days back every thing is working but now 'ionic cordova platform add android' fails .
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
Here is the error:

Any update from the Branch team?
uses-sdk
should no longer be declared in the manifest, please check https://github.com/apache/cordova-android/issues/629
In the version npm i branch-cordova-sdk@^4.0.0 be omit the requese targetVersionSdk use this version
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. https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/601
Any update from the Branch team?
Any news?
Is this being worked on?
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.
@noahcooper did you find a work around? Or @adrianyg7 and way to get around this iOS bug on 4.0.0?
@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.
@echo-branch would it make sense to close this issue now?
Version 3.2.1 works for me.