Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use third party java libraries(.jar) for Android development with Kotlin?

I haven't moved to Kotlin for Android development yet, just wondering if Kotlin supports the available third party libraries for Android as is or they need to be updated in order to work with Kotlin?

like image 640
Amit Avatar asked Jun 10 '17 10:06

Amit


People also ask

Can you use any Java library in Kotlin?

Can I call Android or other Java language library APIs from Kotlin? Yes. Kotlin provides Java language interoperability.

Can I use Java libraries in Android?

To use a Java library (JAR file) inside your Android project, you can simple copy the JAR file into the folder called libs in your application. *. jar files in this folder are included into the compile classpath via the default build.

Can I use Java code in Kotlin for Android?

Android Studio provides full support for Kotlin, enabling you to add Kotlin files to your existing project and convert Java language code to Kotlin. You can then use all of Android Studio's existing tools with your Kotlin code, including autocomplete, lint checking, refactoring, debugging, and more.

Which is the best Kotlin Java for Android development?

Since then, the programming language has seen a monumental rise in demand in both the developer and enterprise community. With Google announcing that Kotlin is now its preferred language for Android app developers, the language is proving to be a pragmatic, modern, and intuitive programming language.


3 Answers

Of course you can do that, see the examples :

https://kotlinlang.org/docs/reference/java-interop.html

https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html

like image 85
Ajeet Choudhary Avatar answered Oct 07 '22 14:10

Ajeet Choudhary


Yes, as Kotlin is 100% interoperable with Java, and both works on JVM. so one can easily use Java libraries with Kotlin.

Please refer this.

like image 32
Ronak Thakkar Avatar answered Oct 07 '22 15:10

Ronak Thakkar


yes, Kotlin is fully interoperable with Java

like image 2
homerman Avatar answered Oct 07 '22 15:10

homerman