NativeScript / NativeScript/nativescript-cli

plugin gradle fail

Open
#4,825 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug os: android plugins
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

If you have a plugin build.gradle like this:

def computeAndroidXVersion() {
    if(project.hasProperty("androidxVersion")) {
        return androidxVersion
    }
    else {
        return "1.0.0"
    }
}

dependencies {
	def androidxVersion = computeAndroidXVersion()

	compile "androidx.appcompat:appcompat:$androidxVersion"
	compile "com.google.android.material:material:1.1.0-alpha07"
}

it will fail to build because the method definition is not added the tempPlugin gradle file. So you end up with an error like this:

	* Where:
Build file '/Volumes/data/dev/nativescript/nativescript-material-components/demo-vue/platforms/tempPlugin/nativescript_material_button/build.gradle' line: 104

* What went wrong:
A problem occurred evaluating root project ‘nativescript_material_button’.
Could not find method computeAndroidXVersion() for arguments [] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the plugin build.gradle example and inspect the generated platforms/tempPlugin/nativescript_material_button/build.gradle file. Trace how the plugin Gradle content is assembled, then verify that method definitions remain available inside the dependencies block and that the example builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, cli, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.