How to Import Library in build.gradle
I've written the url in "repositories" and "implementation('kryonet:kryonet:2.21')" in "dependecies" section, but gradle can't sync it.

45 Replies
⌛
This post has been reserved for your question.
Hey @aliinuur! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
The Screenshot is Maven syntax
Are you using Maven or Gradle?
gradle
What is the actual configuration you are using?
What happens when building from the command-line?

i tried a fresher fork of this library
but
Intellij can't see it still
I don't see the clojars URL in the repositories section
this fork is on jitpack.io
first build it with the command line and then check whether it works with IntelliJ (once the CLI works)
you mean gradle task build?
yes in your terminal
and please include the full output as text (not as a screenshot) if it fails
it didnt fail
What exact command did you run?
Gradle sync went with no errors
ok
but when i try to import com....kryonet it doesnt see the lib
that one is IntelliJ-specific
Do you have multiple build.gradle files?
yes
Did you put it in the common one?
one for android and desktop
yes
I think LibGdX has a common module
Can you show it?
i put it in the projects builld.gradle
no, there should be a third one
4th*

core
that's the one where you need to add the dependency I think
this is core/build.gradle

ehhh ok
all dependencies loaded through Projects build.gradle
Does that one have a
project(":core")
?yes it does have
Can you show it?
i didnt touch it
Does it have a dependencies block?
Can I still see it?

try adding the dependency there
i see now
thanks
core=common between desktop and android
so any dependency that should be available in the common code must be in the core module/project
thank you!
it works!!!
Note: If you put an implementation dependency there, you won't be able to use it from desktop specific code
i have watched 10 videos
about to how import using gradle
everyone telling the same "just one line of code"
you saved my day
well you gotta put it in the right location
ive changed it to api
If a project declares an api dependency, it means "this project can use the dependency but the dependency is also propagated to other projects using it"
so e.g. api dependency in core means it can be used by desktop and android directly as well while implementation dependencies in core can be used only in common code (and modules explicitly declaring the dependency can use it as well)
:letsgoe:
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.