Why do you need this `build.doLast` task? Looks su...
# multiplatform
g
Why do you need this
build.doLast
task? Looks suspicious
a
Just for copying the generated jar file to the top folder in order to do an easier refer from the other local project. Any easy way to do this?
g
Still don’t understand why do you need
a
So, in another project, I can do
compile files('the/path/to/jar/file')
but with a shorter path, otherwise, I need to include all the nest levels
/build/intermediates/bundles/default/
g
Why do you want to do that?
Another porject is also Android?
a
Yes, it is also Android. I created
project-platforms
for platform specific API and
project-libs
for general code which depends on
project-platforms
. Then a real android or ios app to consume the
project-libs
to write an app.
g
Why do you manipulate by jars manually? just add dependency to this project:
Copy code
//projectA/build.gradle
dependencies { compile project(":projectB") }
a
But they are in different projects, if I need to do that, I need to
include
some projects in the
settings.gradle
first
g
Yes, and you should do that
if you need completely separate project just publish this project as aar and use remote maven repo or just local maven repo to access it
a
Thanks. Will look into the local maven repo solution. Why include the project is better than using the consume the local jar file? It seems it will add some noise to the current projects when the IDE tried to display it. Which will add some sub-projects from somewhere else.
g
Because it’s very fragile, non standard way to use dependencies. You just use some intermediate files instead of usage of real dependency. You just hacked build process and build process of Android app is pretty complicated process
Also, Android library is not only jar, Android library format is AAR, that contains a lot of things, not only jar file with code, but Android resources, proguard files, lint rules and even more
I don’t say that include project is better, always better to use binary dependency, if you don’t want to include project and change it all the time. But there is standard way to do that: publish some library as artifact (jar for pure java projects, aar for Android libraries) And than consume this artifact just as any other maven dependency
a
I see. Thanks 🙂