Multiple projects/dependencies and compiling

Apache Cordova recently switched to the gradle for Android builds and I am in the processing of upgrading some plugin to work with gradle.

Cordova allows you to include external projects (frameworks). These get added to the settings.gradle file via imports. They also compile all of them in the build.gradle as dependencies. This is all auto-generated by their CLI tools.

https://raw.githubusercontent.com/imaffett/gradle-dex-issue/master/platforms/android/settings.gradle
https://github.com/imaffett/gradle-dex-issue/blob/master/platforms/android/build.gradle#L251

The issue is I have a sub project that has a dependency on another project. I can use a “build-extras.gradle” file to add this entry.

https://github.com/imaffett/gradle-dex-issue/blob/master/platforms/android/org.apache.cordova.xapkreader/foobar-downloader_library/build-extras.gradle

Without this, the downloader_library will not build. When I add this entry though, I get DEX errors since the main build.gradle is compiling it along with my sub-project.

I’m hoping someone can advise me on what the standard should be for gradle. Should the main build.gradle NOT have a compile entry, or is there something else I can reference in my sub-project so it can build properly.

thanks!

I was getting Dex errors on gradle scripts in sub projects…
A clean build resolved it.