nativescript-contacts icon indicating copy to clipboard operation
nativescript-contacts copied to clipboard

Android build fails with Cannot get property 'dependencies' on null object

Open dlcole opened this issue 3 years ago • 2 comments

I created a new JavaScript Hello World project, added the Android platform, and built the project successfully.

I ran tns plugin add nativescript-contacts and now the build fails with these messages:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/david/Documents/NativeScriptProjects/tester/platforms/tempPlugin/nativescript_contacts/build.gradle' line: 40

* What went wrong:
A problem occurred evaluating root project 'nativescript_contacts'.
> Cannot get property 'dependencies' on null object

The problem is that nativescript-contacts is not being added to the file /platforms/android/dependencies.json. Here's the complete file:

[
    {
        "name": "@nativescript/core",
        "directory": "../../node_modules/@nativescript/core",
        "dependencies": []
    },
    {
        "name": "@nativescript/theme",
        "directory": "../../node_modules/@nativescript/theme",
        "dependencies": []
    }
]

and here's package.json, from which dependencies.json is presumably built:

  "name": "tester",
  "main": "app/app.js",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@nativescript/core": "~8.2.0",
    "@nativescript/theme": "~3.0.2",
    "nativescript-contacts": "^1.6.4"
  },
  "devDependencies": {
    "@nativescript/android": "8.2.2",
    "@nativescript/webpack": "~5.0.6"
  }
}

Has anyone else hit this problem, or have any insights as to why the plugin is missing from dependencies.json? This wasn't a problem until recently, when I upgraded NS to 8.2 because Xcode was updated unexpectedly and introduced build errors on iOS. All the other plugins in my main project are included in dependencies.json and compile OK.

dlcole avatar Mar 22 '22 01:03 dlcole

dlcole, I got the same problem and found that @nativescript/contacts is a "drop in" replacement for this plugin. Works well for both Android and IOD. Actually, it's the exact same code base. Good luck!

tqhsonoma avatar Mar 26 '22 12:03 tqhsonoma

@tqhsonoma - thanks so much! I'll check this out.

dlcole avatar Mar 26 '22 15:03 dlcole