capacitor
capacitor copied to clipboard
bug: same dependency added multiple times in capacitor.build.gradle
If a few cordova android plugins have the same dependency (in example, "com.android.support:support-v4:27.+"
), it gets added multiple times to the capacitor.build.gradle
file, should be added only once.
First, I would say thank you to the Ionic team, we are using Ionic / Capacitor in our client project.
Hello, @jcesarmobile it is a good first issue on cli.
I want to help, could you help me where I can start with this one?
cli code is here https://github.com/ionic-team/capacitor/tree/main/cli/src
you'll need to clone the whole repository, then cd cli && npm install && npm run build
and you'll have a local copy of the CLI.
Then you can npm install it in a sample app, or run npm link
in the cli repository and capacitor
command will be available globally.
You can also use npm run watch
so it rebuild the CLI on every change you make instead of running npm run build
after every change.
Just run it in my local get this npm install && npm run build
any idea this happened @jcesarmobile ?
> @capacitor/[email protected] assets
> node ../scripts/pack-cli-assets.mjs
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tar' imported from /Users/rubiagatra/github/capacitor/scripts/pack-cli-assets.mjs
at new NodeError (node:internal/errors:371:5)
at packageResolve (node:internal/modules/esm/resolve:884:9)
at moduleResolve (node:internal/modules/esm/resolve:929:18)
at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:1044:11)
at Loader.resolve (node:internal/modules/esm/loader:89:40)
at Loader.getModuleJob (node:internal/modules/esm/loader:242:28)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
Run npm install on the root folder too
I tried to install multiple Cordova plugins
⠙ copy android [info] Found 5 Cordova plugins for android:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
✔ copy android in 69.23ms
✔ Updating Android plugins in 8.28ms
[info] Found 5 Cordova plugins for android:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
and on deps
dependencies {
implementation "com.android.support:support-v4:27.+"
implementation "com.google.firebase:firebase-analytics:19.0.+"
implementation "com.google.firebase:firebase-config:21.0.+"
}
are there any particular Cordova plugins that have the same dependency @jcesarmobile?
Specifying the same dependency multiple times is not an issue with Gradle.
Not specifying an exact version however is. In your example, implementation "com.android.support:support-v4:27.+"
will download whatever version was released last. This breaks repeatable builds and keeps Gradle's dependency cache cold as it always has to query Maven repositories for the latest versions.
However, I don't think this issue is still relevant as the capacitor
and capacitor-plugins
projects have been improved already.
Is this issue still up?