Android gradle java and android sub-projects -



Android gradle java and android sub-projects -

i have multi-project build, modules "pure java" modules, jar files output java modules released. these java modules depend on jar files generated android libraries.

is there way specify android module dependency of java module?

the project construction follows:

root | javamodule | build.gradle | androidmodule | build.gradle

the javamodule's build.gradle is:

apply plugin:'java' dependencies{ compile project(:androidmodule) }

the androidmodule's build.gradle is:

apply plugin:'android-library'

adding dependency above, doesn't work, java module not able find symbols in androidmodule.

i guess issues androidmodule generates aar file, java plugin doesn't understand.

as part of build, androidmodule generates classes.jar. there way specify dependency on classes.jar file?

you've correctly identified need reference jar output android library projects. there two(ish) ways this.

manual approach

simply re-create jar files parent project , reference them android project:

compile filetree(dir: 'libs', include: ['*.jar'])

i.e., create libs folder in project , drop jar in there. depending on volatility of these libraries, may easiest simplest approach.

maven approach

if libraries changing, pain manually re-create jars around. of course of study utilize scripts automate it, improve solution imo deploy jars local maven repository. can accomplished standard maven-publish gradle plugin. reference dependencies maven central, i.e.:

dependencies { compile 'com.your.module:1.0.+@jar' }

in setup, build each library , publish jar local maven repo on own machine (for example), , dependent projects set download binary there.

android gradle android-gradle

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -