Hi all! Can I ask a little question here? I'm look...
# android
g
Hi all! Can I ask a little question here? I'm looking for some help about porting an app from Android to Kotlin
a
do you mean java to kotlin?
g
@asad.awadia Yes, Java Android to Kotlin... in the meantime the answer I've received is that I need to move to Gradle first, from my Eclipse ADT (and it doesn't look too easy, unfortunately)
d
Eclipse? sounds familiar. i heard that ancient programmers used it in 19th century for their very first steam computer programs
g
Wow, you have really old project. In you case of course you should migrate to Gradle first before moving to Kotlin. Yes, it can be hard, but Android Studio provides some facilities to do that automatically. Also one way: just create a new template project in AS and move all your sources/jars there (or even replace jar with proper dependency).
g
On Kotlin Google Plus [1], they keep saying I can mix old Java with Kotlin: is it really doable in this case? (should you think so, then how exactly?) Thanks 🙂 [1]: https://plus.google.com/101251753720588443930/posts/W84XEysfM5d
g
Of course
You can, and my IMHO that you should
because Kotlin has 100% interop with java
and usually you don’t want to rewrite to Kotlin just because you add Kotlin to you project
AS/Idea can convert files automatically, but I don’t see any gain from this. In our project we keep old code in Java, write new code in Kotlin, sometimes, when we need some big changes in Java code we convert class to Kotlin automatically and that refactor it and improve using Kotlin features (remove all problems with nullability, use Kotlin idioms instead of Java idioms)
should you think so, then how exactly
What do you mean? Just add Kotlin Gradle plugin and Kotlin stdlib to your project (check Kotlin docs - https://kotlinlang.org/docs/tutorials/kotlin-android.html). But I see that it already thedone e in your project). After that just create Kotlin file, that’s all. Of course you cannot mix kotlin and java in the same file, but you can just create Kotlin file in the same package with Java
g
OK, thanks for the confirmation, so I will try to do in that way, if I find a good starting point for google drive integration. Thank you!