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

Ahmet Özcan

09/20/2022, 3:36 PM
Hi everyone, Do you know how can i add an aar file (3rd party dependency) to one of my multi platform module for android platform side i tried to create an empty folder with that build.gradle file and aar file
Copy code
configurations.maybeCreate("default")
artifacts.add("default", file('3rd_party_sdk.aar'))
then i add that as a dependency to my mainAndroid dependency and it worked but now there are bunch of errors when syncing gradle which also ends with success but i cant use any code complation etc.
m

mkrussel

09/20/2022, 3:44 PM
I just ran into this also. You have to set it up as a local maven repository. Create a maven repository in your repository section with a file URL. Then configure your directory structor how maven servers structure them. Need to include a pom file for it.
Comments here shows how to modify gradle. https://youtrack.jetbrains.com/issue/IDEA-274929
a

Ahmet Özcan

09/20/2022, 3:47 PM
Thank you very much i ll look into it
Do you think i need .pom.md5 and .aar.md5 files as well ?
m

mkrussel

09/20/2022, 4:56 PM
I didn’t use them
a

Ahmet Özcan

09/20/2022, 5:04 PM
hmmm i did the folder structure put pom file and the aar file but gradle keep seying faild to resolve file 😞
m

mkrussel

09/20/2022, 5:07 PM
Did you remove our old gradle project with the artifact and update the dependency to use normal dependencies (
api("group:artifact:version"
) instead of the project dependency?
a

Ahmet Özcan

09/20/2022, 5:08 PM
thats how it looks like
and yes i removed the old ones
m

mkrussel

09/20/2022, 5:09 PM
And what does the repository you added look like?
a

Ahmet Özcan

09/20/2022, 5:10 PM
i forgot to send that sorry 🙂
m

mkrussel

09/20/2022, 5:11 PM
Should probably be rootDir instead of projectDir
That’s all that I see different from what I did.
The not found message should list all the paths it tried for downloading, so you might be able to detect the problem that way.
You also need to specify the packaging in the pom file.
<packaging>aar</packaging>
The packaging line should fix that.
a

Ahmet Özcan

09/20/2022, 5:15 PM
yes it fixed that 🙂
the references still not included but this is a different problem i guess
thnk you very much for you help
m

mkrussel

09/20/2022, 5:17 PM
Should be possible to include the reference and source the same way you do the .aar file. I had no reference, so I skipped it.
a

Ahmet Özcan

09/20/2022, 5:29 PM
its ok now that was just a corrupt file
thank you very much for you help 🙏
m

mkrussel

09/20/2022, 5:29 PM
np
129 Views