2 ms·
I just wish there was an officially supported way to get set up with a kotlin-first Android project from the command line. So far the best documentation I've se
by e12e 11y ago
I just wish there was an officially supported way to get set up with a kotlin-first Android project from the command line. So far the best documentation I've seen is:
http://kotlinlang.org/docs/tutorials/kotlin-android.html http://kotlinlang.org/docs/tutorials/kotlin-android.html
Which a) requires one use the IDE. Maybe not surprising from a company that sells IDEs, but it's not my dream environment. b) Even then, one is asked to manually "replace java kode with kotlin" (with help of a wizard). Couldn't we just get a script/function that'll set up a project targeting the desired Android API level?
It'd be nice if kotlin provided a script/command-line utility that basically allowed the equivalent of:
android create project -a Main -p hello \
-k com.example.app
-t android-15 -g -v 1.3.1
cd hello/
# Note that even android sdk is broken,
# one needs to manually change:
#
# runProguard false
#
# to
#
# minifyEnabled false
#
# in build.gradle
gradle build
# Start emulator (android avd...)
# possibly (re)start adb server
#
adb install ./build/outputs/apk/hello-debug.apk
I'm still figuring out the Android/java command-line/build workflow, but I suppose one should be able to drop the kotlin.jar somewhere, and add something to build.gradle. I've yet to find any documentation how how to do that (official or otherwise).
Am I really the only one that wants a predictable, scriptable environment in which I can both initiate development from scaffolding supported by upstream, and have a reasonable grasp over the entire build process?
I mean, we all want to automate this for Continous Integration, right?
- kensuke155 11y agoHere's the reference for building for Android with Gradle: http://kotlinlang.org/docs/reference/using-gradle.html#targeting-android http://kotlinlang.org/docs/reference/using-gradle.html#targe... And other build tools: http://kotlinlang.org/docs/tutorials/build-tools.html http://kotlinlang.org/docs/tutorials/build-tools.html
- e12e 11y agoThank you for the reminder, I'd looked at that, and forgot while figuring out why the "android sdk" skeleton didn't work (see note above about manually patching the build-file). At least now I should be able to get a proper java skeleton, fix the build, add support for kotlin. Only missing piece would be a supported "pure" kotlin Android project/skeleton generator. At some point I also looked at the Android example at the bottom of that page: https://github.com/JetBrains/kotlin-examples/tree/master/gradle/android-mixed-java-kotlin-project https://github.com/JetBrains/kotlin-examples/tree/master/gra... -- that is also IDE centric, and hasn't been touched in a while. Which doesn't leave me very confident that it's been tested with Android 5.1 and/or 6 alpha. I suppose I'll just have to push out a "howistart"-article if/when I figure out a process that is both easy and repeatable, and hope someone will help with filing bugs as it inevitably drifts towards being outdated as the android landscape changes :-)