kotlin-examples icon indicating copy to clipboard operation
kotlin-examples copied to clipboard

Importing examples

Open da-na opened this issue 9 years ago • 2 comments

Hi guys! Could you provide step by step instruction on how to import those examples into IntelliJ or Android Studio? I tried for a whole day, and didn't manage to get the android-butterknife example up and running on emulator :(

Thanks!

da-na avatar Apr 26 '16 20:04 da-na

Ok.. After a lot of fight I figured out how to get it up on running and such description would be awesome on wiki or readme for newbies like me! I wanted to check out Kotlin and Butterknife, since I've heard a lot of good stuff about those, but I'm not a seasoned Android dev and I didn't expect that just getting the configuration right would take me so much time..

Anyways, here's info for all who want to play with the examples and are new(ish) to Android dev. On my Mac I have Java 8 installed and newest Intellij (IntelliJ IDEA 2016.1.1 Build #IC-145.597, built on March 29, 2016).

I cloned the repo git clone https://github.com/JetBrains/kotlin-examples and before trying to import it into Intellij I have modified the following files:

kotlin-examples/gradle/android-butterknife/build.gradle

  • changed from: classpath 'com.android.tools.build:gradle:1.5.0'
  • to: classpath'com.android.tools.build:gradle:2.0.0'

kotlin-examples/gradle/android-butterknife/app/build.gradle

  • changed from: ext.kotlin_version = '1.0.0'
  • to: ext.kotlin_version = '1.0.1-2'
  • changed from: buildToolsVersion "23.0.2"
  • to: buildToolsVersion "24.0.0 rc3"

kotlin-examples/gradle/android-butterknife/gradle/wrapper/gradle-wrapper.properties

  • changed from: distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
  • to: distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip

Then I have selected the topmost build.gradle in android-butterknife directory screen shot 2016-04-27 at 9 26 47 am and imported the project using auto-import and gradle wrapper task configuration screen shot 2016-04-27 at 9 28 10 am

After that I can build the project and play with it in the smulator :) Hopefully this description will help folks not to get discouraged too quickly if they're new to Android and just want to play with examples you have provided.

da-na avatar Apr 27 '16 14:04 da-na

Hello! Sorry for the late answer.

Examples in this repository actually was a bit outdated. I've updated the Android Gradle plugin versions, as well as third-party library versions (including ButterKnife, Dagger, etc.), so now there should be no problem in importing projects (tested in Android Studio 2.1).

yanex avatar May 11 '16 13:05 yanex