Once after I create a Gradle project in IntelliJ using the default gradle wrapper and create directories option I see the project structure gets created with build.gradle
file.
IntelliJ tips me to "You can configure Gradle wrapper to use distribution with sources. It will provide IDE with Gradle API/DSL documentation" - but I am not able to attach the sources even after clicking "Ok, apply suggestion". The Gradle project is getting refreshed but the sources are not attached.
We are using a Nexus repository.
Open the Project pane from the left side of the IDE and select the Android view. Right-click on the module you would like to link to your native library, such as the app module, and select Link C++ Project with Gradle from the menu.
With Intellij 14 you can just open the the build. gradle file using Intellij's File --> Open. this will import the gradle project, including all dependencies.
Go to File > Settings (or hit Ctrl + Alt + s ), and navigate to Build, Execution, Deployment > Build Tools > Gradle. Select Automatically import this project on change to build script files and hit OK: JetBrains, who created IntelliJ IDEA, say that this setting can slow things down on large projects.
To improve on @anon58192932 answer you can use only gradleVersion and distributionType fields of Wrapper task and don't need to manually create distributionUrl which is more error prone since you could change gradle version in one place, but not in the other.
task wrapper(type: Wrapper) { gradleVersion = '4.2' distributionType = Wrapper.DistributionType.ALL }
@edit gradle 4.8+ will produce error for above. Use instead
wrapper { gradleVersion = '4.2' distributionType = Wrapper.DistributionType.ALL }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With