https://kotlinlang.org logo
Title
t

therealbluepandabear

03/20/2021, 10:30 PM
Can anyone recommend some good Gradle tutorials? I'm having a hard time finding good Gradle tutorials... I also want to work with the Kotlin DSL
:google: 2
t

therealbluepandabear

03/21/2021, 1:28 AM
@Brian Dilley thanks I will look at this. 👍
b

bodiam

03/22/2021, 2:55 AM
Is there anything specific you’re looking for? I generally create a Kotlin based Gradle file from IntelliJ to get started with, and go as I see fit.
t

therealbluepandabear

03/22/2021, 2:56 AM
@bodiam how do I do this? I tried but it didn't work... In Android Studio they automatically have a gradle wrapper so it uses gradle by default, but I'm having trouble with IntelliJ...
b

bodiam

03/22/2021, 2:57 AM
you go to
File -> New Project -> Gradle -> check Kotlin DSL build script -> pick Kotlin/JVM
, and that should do it.
t

therealbluepandabear

03/22/2021, 2:57 AM
@bodiam Ok I will tell you if there are problems
b

bodiam

03/22/2021, 2:58 AM
that’s fine, happy to help.
t

therealbluepandabear

03/22/2021, 2:58 AM
@bodiam do I need to also check 'java'?
b

bodiam

03/22/2021, 2:58 AM
I depends. Only if you’re planning on using Java. You can enable it, it doesn’t hurt, but it’s not needed.
(I think it will only enable the Gradle Java plugin, nothing more)
t

therealbluepandabear

03/22/2021, 2:59 AM
@bodiam I get this:
b

bodiam

03/22/2021, 3:00 AM
not sure what that is. Could be just a warning.
or maybe click on the
Load Script Configurations
t

therealbluepandabear

03/22/2021, 3:00 AM
@bodiam I did... but it returned, when I press '?' I get this:
b

bodiam

03/22/2021, 3:02 AM
I just created a new project myself, I’m getting the same warning as you. Gimme a moment
t

therealbluepandabear

03/22/2021, 3:02 AM
@bodiam yeah... strange... with Android Studio gradle was automatically integrated in my project, so at least I don't have to worry about that
b

bodiam

03/22/2021, 3:04 AM
okay. I got the same message as you, but only while it was indexing (downloading Gradle, indexing libraries, etc)
after that, the message went away
this is before
and this is after indexing / downloading gradle was completed
t

therealbluepandabear

03/22/2021, 3:05 AM
@bodiam maybe I didn't install gradle properly?
b

bodiam

03/22/2021, 3:06 AM
you don’t have to, IntelliJ will download the gradle wrapper itself
t

therealbluepandabear

03/22/2021, 3:06 AM
@bodiam I got this
b

bodiam

03/22/2021, 3:06 AM
you could try reloading the gradle project
well, that might be an issue indeed.
I don’t have a
JAVA_HOME
set
t

therealbluepandabear

03/22/2021, 3:06 AM
@bodiam should I just delete the 'java_home'
b

bodiam

03/22/2021, 3:07 AM
if you don’t need it, then yes
t

therealbluepandabear

03/22/2021, 3:09 AM
I got this also:
@bodiam how come with android studio gradle works fine though but not with IntelliJ?
b

bodiam

03/22/2021, 3:10 AM
not sure, I don’t have experience with Android Studio
t

therealbluepandabear

03/22/2021, 3:10 AM
@bodiam have you set any environment variables for Gradle?
b

bodiam

03/22/2021, 3:10 AM
maybe just remove that whole Gradle directory? (or maybe it’s in use by something, like Android Studio?)
not sure what you mean with
environment variables for Gradle
. Why would you want to do that?
t

therealbluepandabear

03/22/2021, 3:11 AM
@bodiam I don't know... I"m just confused why I'm getting these annoying problems.
b

bodiam

03/22/2021, 3:12 AM
Oh, I call it “Software Development”
🤣 1
it’s an endless series of annoying problems 🙂
t

therealbluepandabear

03/22/2021, 3:12 AM
@bodiam how did you install gradle in the first place?
b

bodiam

03/22/2021, 3:12 AM
I didn’t
t

therealbluepandabear

03/22/2021, 3:12 AM
@bodiam how did it come up for you?
b

bodiam

03/22/2021, 3:12 AM
I only use Gradle wrappers
which are auto downloaded by IntelliJ
t

therealbluepandabear

03/22/2021, 3:13 AM
@bodiam How do I use a Gradle wrapper?
b

bodiam

03/22/2021, 3:14 AM
whenever you create a new Gradle project, there’s a
gradlew.bat
. If you type
gradlew clean build
instead of
gradle clean build
, (not the
w
), then it will use the wrapper. The wrapper will download Gradle if it’s not in the project yet, so you can have 1 project use Gradle 3.4, and the other 4.6, for example, instead of needing a system wide installation (which is common with Maven for example)
t

therealbluepandabear

03/22/2021, 3:16 AM
@bodiam tried that but i got: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-6.8-bin.zip'.
😞
b

bodiam

03/22/2021, 3:16 AM
are you behind a (corporate?) firewall / proxy? The link is fine
t

therealbluepandabear

03/22/2021, 3:17 AM
@bodiam?? what do you mean
b

bodiam

03/22/2021, 3:17 AM
I’m not sure how to rephrase my question.
t

therealbluepandabear

03/22/2021, 3:17 AM
I'm not sure what you meant by that question
b

bodiam

03/22/2021, 3:18 AM
basically, are you connected directly to the internet, or are you at work and this link is blocked by something
(usually a firewall, a proxy server, whatever)
t

therealbluepandabear

03/22/2021, 3:18 AM
@bodiam im not at work... im not behind a firewall also
b

bodiam

03/22/2021, 3:18 AM
in that case, I don’t know really.
in a case like that, I’d just try again. Sometimes works 🙂
b

Brian Dilley

03/22/2021, 3:20 AM
What happens if you click that URL Tom
t

therealbluepandabear

03/22/2021, 3:20 AM
@bodiam this is my AS project, it has Gradle by default - but not on Intellij:
@Brian Dilley you're scaring me lol
b

Brian Dilley

03/22/2021, 3:21 AM
No, I'm trying to help you
t

therealbluepandabear

03/22/2021, 3:21 AM
@Brian Dilley It downloads gradle 6.8 (not wrapper) for me
It's already downloaded though on my machine
b

bodiam

03/22/2021, 3:22 AM
might be the same problem as you mentioned before (with the “could not create parent project”)
t

therealbluepandabear

03/22/2021, 3:23 AM
@bodiam maybe I should just uninstall gradle and use the wrapper? I understand you don't have gradle installed you are just using the wrapper - maybe I can try that? sorry if it sounds stupid
b

bodiam

03/22/2021, 3:23 AM
maybe just kill that directory? maybe something is using it or so, like the gradle daemon, android studio, or what not.
t

therealbluepandabear

03/22/2021, 3:24 AM
@bodiam how do I do that?
b

bodiam

03/22/2021, 3:24 AM
no, that doesn’t sound stupid, and even if it did, it might work.
just delete the directory.
or like you said, uninstall gradle
t

therealbluepandabear

03/22/2021, 3:24 AM
@bodiam ok.
@bodiam where is the directory located?
b

bodiam

03/22/2021, 3:25 AM
it’s in your screenshot
t

therealbluepandabear

03/22/2021, 3:25 AM
@bodiam ok
b

bodiam

03/22/2021, 3:25 AM
c:\program files\gradle-something-something
t

therealbluepandabear

03/22/2021, 3:33 AM
@bodiam OK I uninstalled it, what do I input here:
what does say for your configuration?
@bodiam good news, I think it's working
👏
b

bodiam

03/22/2021, 3:48 AM
“think” it’s working, or “it’s working?“. How did you resolve?
t

therealbluepandabear

03/22/2021, 3:49 AM
@bodiam i uninstalled the gradle, and it did a clean install of what was needed. Also, How do I create a new Kotlin file in my gradle project?
Also this is how it looks for me (is this how it's supposed to look?):
Nevermind, just created a new file called 'src' and marked it as 'sources root' and it worked.
b

bodiam

03/22/2021, 3:54 AM
IntelliJ will create (and mark) those directories for you if you give it a bit of time
t

therealbluepandabear

03/22/2021, 3:56 AM
I'm getting this new problem:
It's also not finding 'main' which is strange
b

bodiam

03/22/2021, 4:02 AM
it’s because you don’t have Kotlin configured
t

therealbluepandabear

03/22/2021, 4:02 AM
@bodiam how do I configure it?