A type of SDK management tool. It is convenient because you can easily switch versions in various SDKs such as Kotlin and Gradle.
Execute the following command to install.
$ curl -s "https://get.sdkman.io" | bash
$ source "~/.sdkman/bin/sdkman-init.sh"
#Display a list of Gradle versions that can be installed with SDKMAN
$ sdk list gradle
================================================================================
Available Gradle Versions
================================================================================
4.7-rc-1 4.4 3.5.1 2.3
4.6-rc-2 4.3.1 3.5 2.2.1
4.6-rc-1 4.3-rc-4 3.4.1 2.2
4.6 4.3-rc-3 3.4 2.14.1
4.5.1 4.3-rc-2 3.3 2.14
4.5-rc-2 4.3-rc-1 3.2.1 2.13
4.5-rc-1 4.3 3.2 2.12
4.5 4.2.1 3.1 2.11
4.4.1 4.2-rc-2 3.0 2.10
4.4-rc-6 4.2-rc-1 2.9 2.1
4.4-rc-5 4.2 2.8 2.0
4.4-rc-4 4.1 2.7 1.9
4.4-rc-3 4.0.2 2.6 1.8
4.4-rc-2 4.0.1 2.5 1.7
4.4-rc-1 4.0 2.4 1.6
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
#I don't know which version is better, so install without specifying the version
$ sdk install gradle
# 4.6 is installed, but there is a warning
$ gradle --version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/{username}/.sdkman/candidates/gradle/4.6/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------
Build time: 2018-02-28 13:36:36 UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 9.0.4 (Oracle Corporation 9.0.4+11)
OS: Mac OS X 10.13.1 x86_64
When I checked the warning output when gradle --version
, it seems to be an error that occurs when using JDK 9.
https://github.com/gradle/gradle/issues/3118
I heard that you should use JDK 8, so this time I will do so.
$ jenv global oracle64-1.8.0.162
$ gradle --version
------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------
Build time: 2018-02-28 13:36:36 UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_162 (Oracle Corporation 25.162-b12)
OS: Mac OS X 10.13.1 x86_64
The warning is no longer output.
Install it in the same way as Gradle.
$ sdk list kotlin
================================================================================
Available Kotlin Versions
================================================================================
1.2.31 1.1.2-5 1.0.4
1.2.30 1.1.2-2 1.0.3
1.2.21 1.1.2 1.0.2
1.2.20 1.1.1 1.0.1-2
1.2.10 1.1-beta2 1.0.1-1
1.2.0 1.1-beta 1.0.1
1.1.61 1.1-RC 1.0.0
1.1.60 1.1-M04
1.1.51 1.1-M02
1.1.50 1.1-M01
1.1.4-3 1.1
1.1.4-2 1.0.7
1.1.4 1.0.6
1.1.3-2 1.0.5-2
1.1.3 1.0.5
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
$ sdk install kotlin
$ sdk list kotlin
================================================================================
Available Kotlin Versions
================================================================================
> * 1.2.31 1.1.2-5 1.0.4
1.2.30 1.1.2-2 1.0.3
1.2.21 1.1.2 1.0.2
1.2.20 1.1.1 1.0.1-2
1.2.10 1.1-beta2 1.0.1-1
1.2.0 1.1-beta 1.0.1
1.1.61 1.1-RC 1.0.0
1.1.60 1.1-M04
1.1.51 1.1-M02
1.1.50 1.1-M01
1.1.4-3 1.1
1.1.4-2 1.0.7
1.1.4 1.0.6
1.1.3-2 1.0.5-2
1.1.3 1.0.5
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
You can install multiple versions of each SDK.
Use the sdk default
command to select the SDK to use by default.
# sdk default {SDK} {version}
$ sdk default kotlin 1.2.31
A list of SDKs used by the sdk current
command is output.
$ sdk current
Using:
gradle: 4.6
kotlin: 1.2.31
I was able to install Gradle and Kotlin. Now you should be able to develop Android apps.
Since it was written in .bash_profile
, I edited it to work even in an environment where SDKMAN is not installed.
.bash_profile
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
- export SDKMAN_DIR="/Users/{username}/.sdkman"
- [[ -s "/Users/{username}/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/{username}/.sdkman/bin/sdkman-init.sh"
+ export SDKMAN_DIR="$HOME/.sdkman"
+ if [ -d "${SDKMAN_DIR}" ]; then
+ [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
+ fi
Recommended Posts