https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
g

gildor

03/08/2018, 1:39 AM
Why do you need this
build.doLast
task? Looks suspicious
a

albertgao

03/08/2018, 1:40 AM
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

gildor

03/08/2018, 1:41 AM
Still don’t understand why do you need
a

albertgao

03/08/2018, 1:43 AM
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

gildor

03/08/2018, 1:53 AM
Why do you want to do that?
Another porject is also Android?
a

albertgao

03/08/2018, 1:56 AM
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

gildor

03/08/2018, 2:10 AM
Why do you manipulate by jars manually? just add dependency to this project:
Copy code
//projectA/build.gradle
dependencies { compile project(":projectB") }
a

albertgao

03/08/2018, 2:11 AM
But they are in different projects, if I need to do that, I need to
include
some projects in the
settings.gradle
first
g

gildor

03/08/2018, 2:11 AM
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

albertgao

03/08/2018, 2:20 AM
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

gildor

03/08/2018, 2:22 AM
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

albertgao

03/08/2018, 2:32 AM
I see. Thanks 🙂
3 Views