jvoegele/gradle-android-plugin — Issue #42: Resources from external JARs not packaged correctly
Author: ckesselh
Created: 2012-01-02 20:35:00+00:00
State: open

Hi there,

I'm fairly new to both Android and Gradle, so please bear with me.

I've recently run into some trouble when using Gradle to build my Clojure-based Android applications. As it turns out, the root cause of this lay with the Gradle Android plugin itself: Unlike e.g. its default Ant or Maven counterpart, it currently doesn't seem to configure the underlying Ant tasks properly so that non-Java resource (e.g. property) files are also included in the final APK (as well as its manifest). When using a library that (for one reason or the other) depends on those resources to be there at run-time, that turns out a problem.

I see a number of possible solutions:

1) Instruct the ApkBuilder task to simply Include all non-Java resources from all external (i.e. runtime) dependency JARs building the APK. This is more or less what the basic Android Ant set-up or the equivalent Maven plugin does by default. For now, I've created myself some small patch to the Gradle Android plugin that does just this, you can find it here: https://github.com/ckesselh/gradle-android-plugin/commit/e41d8ccd585885cf705f8df887decf578c6a9acb . Obvious disadvantage: The user has no straightforward way to manually exclude/include any JARs on a per-project basis.
2) Add a new configuration (e.g. "android") as a parent to "runtime" that could then be used by the user to manually list those dependencies for which non-Java resources should be included. This would be somewhat similar to the "gwt" configuration used in scope of the Gradle GWT plugin, I guess.
3) Add some other configuration parameter that would allow the user to somehow influence the process.

I'm willing to hand-in a pull request with the necessary changes myself (in good time); what I'm currently looking for is some sound advice on what would actually be the best way to proceed (see options above).

Any ideas?

Regards,

Chris