firescript / nativescript-contacts

A nativescript module that gives access to the native contact directory.
MIT License
28 stars 32 forks source link

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

Open dlcole opened 2 years ago

dlcole commented 2 years ago

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.

tqhsonoma commented 2 years ago

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!

dlcole commented 2 years ago

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