Skip to content

Fix duplicate Android packages being linked #43

@grabbou

Description

@grabbou

Recent commit updated Android part of the link mechanism to use "implementation" instead of "compile" to align with what Gradle recommends: c6c34a2

Unfortunately, it breaks the detection of an already installed packages.

The way "link" detects an installed package on Android is by looking for "compile(XXX)" inside build.gradle. We don't have a sophisticated tool for parsing and reading Gradle files, hence we use a really simple RegExp to look for informations that we want. It was always meant to be a temporary solution, so we are going to work on resolving that in the nearest future.

Meanwhile, what happens is that now, after the update, "link" will look for "implementation(XXX)" string instead to indicate that the given package is already linked.

This means that when "link" command is run on an existing codebase that still uses "compile" (e.g. just updated to a new project), it will not treat such project as installed and will add it once again, this time using implementation(XXX). This results with duplicate packages.

We should teach link/android/isInstalled.js to return "true" in both scenarios when "compile" and "implementation" are present. Both are valid right now in Gradle v3 (with "compile" being obsolete).

We should also make sure that "unlink" can handle both cases.

CC: @thymikee @dulmandakh (original reviewer of the PR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions