You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @HarelM, thanks for spotting this. We've identified this as a low priority and aren't looking to take it on anytime soon. However, we would be greatly appreciative if you—or another community member—would like to open a PR with these fixes.
To be honest, this was opened two month ago and only now I got a response.
So I'm not very thrilled to open a PR that will sit and wait for a review...
I personally solved this on my end by removing the cordova bridge plugin since I no longer use any cordova plugins, but that might not be a proper solution to other users.
I'm guessing you could send a short AI prompt to solve this, similar to what I would do if I needed to open a PR.
If by opening a PR it would help from a "required review" perspective I can help out...
Hi, I'd like to pick this up, but I want to check the approach with you first, because a plain swap to fileTree would break some Cordova plugins.
The flatDir entries are there for Cordova plugins that ship .aar files. cap sync copies those into capacitor-cordova-android-plugins/src/main/libs, and some plugins reference them by name (implementation(name: 'foo', ext: 'aar')), which only resolves through a flatDir in both that module and the app. That's why it was kept in #5287.
What I'd suggest, so nobody breaks:
Remove the flatDir blocks from the two templates (android-template/app/build.gradle and capacitor-cordova-android-plugins/build.gradle).
In cap sync, add them back only when an installed Cordova plugin actually puts files into src/main/libs: in the plugins module's build.gradle (the CLI already regenerates that module on every sync) and in app/capacitor.build.gradle, which the CLI also regenerates and the app already applies.
New apps without such plugins would build with no warning. Apps with them keep working, because the repository is still there when it's needed. Existing apps keep their current app/build.gradle, so nothing changes for them unless they remove the block themselves.
I'd test it with a fresh app and with a Cordova plugin that ships an .aar before opening the PR. Would you take a PR like this against main, or would you rather keep it for the next major on next?
Hi @DevShoaib78, are you still working on this? If you've moved on, I'd be happy to pick it up using the approach you outlined (drop flatDir from the templates, and have cap sync add it back only when a Cordova plugin ships files into src/main/libs). Either way, I can help test on Linux + Android with a Cordova plugin that ships an .aar.
Adding a Cordova plugin that ships no .aar (cordova-plugin-device@3.0.0) still produces the warning twice, from app/capacitor.build.gradle and from capacitor-cordova-android-plugins/build.gradle, even though src/main/libs doesn't exist.
So what's left is the second half of the approach above: emit flatDir only when a Cordova plugin actually copies files into src/main/libs.
Activity
eric-horodyski commentedon Oct 22, 2026
Hi @HarelM, thanks for spotting this. We've identified this as a low priority and aren't looking to take it on anytime soon. However, we would be greatly appreciative if you—or another community member—would like to open a PR with these fixes.
HarelM commentedon Oct 25, 2026
To be honest, this was opened two month ago and only now I got a response.
So I'm not very thrilled to open a PR that will sit and wait for a review...
I personally solved this on my end by removing the cordova bridge plugin since I no longer use any cordova plugins, but that might not be a proper solution to other users.
I'm guessing you could send a short AI prompt to solve this, similar to what I would do if I needed to open a PR.
If by opening a PR it would help from a "required review" perspective I can help out...
DevShoaib78 commentedon Nov 7, 2026
Hi, I'd like to pick this up, but I want to check the approach with you first, because a plain swap to
fileTreewould break some Cordova plugins.The
flatDirentries are there for Cordova plugins that ship.aarfiles.cap synccopies those intocapacitor-cordova-android-plugins/src/main/libs, and some plugins reference them by name (implementation(name: 'foo', ext: 'aar')), which only resolves through aflatDirin both that module and the app. That's why it was kept in #5287.What I'd suggest, so nobody breaks:
flatDirblocks from the two templates (android-template/app/build.gradleandcapacitor-cordova-android-plugins/build.gradle).cap sync, add them back only when an installed Cordova plugin actually puts files intosrc/main/libs: in the plugins module'sbuild.gradle(the CLI already regenerates that module on every sync) and inapp/capacitor.build.gradle, which the CLI also regenerates and the app already applies.New apps without such plugins would build with no warning. Apps with them keep working, because the repository is still there when it's needed. Existing apps keep their current
app/build.gradle, so nothing changes for them unless they remove the block themselves.I'd test it with a fresh app and with a Cordova plugin that ships an
.aarbefore opening the PR. Would you take a PR like this againstmain, or would you rather keep it for the next major onnext?aFeruz commentedon Dec 4, 2026
Hi @DevShoaib78, are you still working on this? If you've moved on, I'd be happy to pick it up using the approach you outlined (drop
flatDirfrom the templates, and havecap syncadd it back only when a Cordova plugin ships files intosrc/main/libs). Either way, I can help test on Linux + Android with a Cordova plugin that ships an.aar.aFeruz commentedon Dec 4, 2026
Quick update after testing on 9.0.0 (Linux, JDK 21,
./gradlew help --warning-mode all):flatDirblock inapp/capacitor.build.gradleconditional, so the "any new project" case from the original report looks fixed in 9.0.0..aar(cordova-plugin-device@3.0.0) still produces the warning twice, fromapp/capacitor.build.gradleand fromcapacitor-cordova-android-plugins/build.gradle, even thoughsrc/main/libsdoesn't exist.So what's left is the second half of the approach above: emit
flatDironly when a Cordova plugin actually copies files intosrc/main/libs.