Will AOSP accept Kotlin code to the Android framework someday?

3,637 views
Skip to first unread message

Jonathan Marsaud

unread,
Jan 1, 2018, 10:40:34 AM1/1/18
to android-platform
Hi,

I would like to know if AOSP is planning to accept Kotlin contribution for the framework API classes.
I'm not talking about rewritting, but just profits of the interoperability of Kotlin to write new AOSP classes in this language.
If not, what are the cons?

Have a nice day and a happy new year!

mykola.n...@motorolasolutions.com

unread,
Jan 4, 2018, 12:17:48 PM1/4/18
to android-platform
I am also interested in this question. Is it possible to use a kotlin in aosp development?
Can I compile kotlin sources with Android.mk? How?

Colin Cross

unread,
Jan 4, 2018, 5:06:00 PM1/4/18
to android-...@googlegroups.com
Kotlin is not supported in Android.mk, and will likely never be.  It is supported by the build system in java_library and android_app modules defined in Android.bp files, but both kotlin support and Android.bp support for java is still relatively rudimentary.  We are not yet accepting any Kotlin code that gets installed on the device, but we have used it in a few places for tools on the host, e.g. https://android-review.googlesource.com/c/platform/frameworks/base/+/570862 and https://android-review.googlesource.com/c/platform/system/tools/hidl/+/516520.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.

Himanshu Mistri

unread,
Jan 16, 2018, 10:33:14 AM1/16/18
to android-...@googlegroups.com
Hello ,

I understand that currently we can not able to write kotlin code for android framework, But what about putting my own developed kotlin app into  path like this (https://android.googlesource.com/platform/packages/apps/Contacts/) and get build it within android os so that my all will come as a system app.Where app source code will be written in kotlin and include it as system app.

Any advice or help will be great to move ahead.

Thanks,
Himanshu



On 5 January 2018 at 03:34, Colin Cross <ccr...@android.com> wrote:
Kotlin is not supported in Android.mk, and will likely never be.  It is supported by the build system in java_library and android_app modules defined in Android.bp files, but both kotlin support and Android.bp support for java is still relatively rudimentary.  We are not yet accepting any Kotlin code that gets installed on the device, but we have used it in a few places for tools on the host, e.g. https://android-review.googlesource.com/c/platform/frameworks/base/+/570862 and https://android-review.googlesource.com/c/platform/system/tools/hidl/+/516520.

On Thu, Jan 4, 2018 at 7:10 AM, <mykola.nikolayev@motorolasolutions.com> wrote:
I am also interested in this question. Is it possible to use a kotlin in aosp development?
Can I compile kotlin sources with Android.mk? How?

On Monday, January 1, 2018 at 10:40:34 AM UTC-5, Jonathan Marsaud wrote:
Hi,

I would like to know if AOSP is planning to accept Kotlin contribution for the framework API classes.
I'm not talking about rewritting, but just profits of the interoperability of Kotlin to write new AOSP classes in this language.
If not, what are the cons?

Have a nice day and a happy new year!

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.



--

Thanks & Regards

Himanshu Mistri

Software Engineer 

+91-8460514154
+91-8758468857

mistrihimanshu@gmail.com

Skype id : herry4003

Colin Cross

unread,
Jan 16, 2018, 5:16:29 PM1/16/18
to android-...@googlegroups.com
This will eventually work using an android_app module in an Android.bp file for your system app with Kotlin sources, and may work today, but should not be considered fully supported yet.  If your system app has any dependencies, especially android-support-*, you will likely find that those do not yet work in Android.bp files.

mykola.n...@motorolasolutions.com

unread,
Jan 17, 2018, 10:29:20 AM1/17/18
to android-platform
I tried and I can not

android_app {
    name: "AmpKotlinTest",
    certificate: "platform",
    manifest: "app/src/main/AndroidManifest.xml",
    srcs: [
        "app/src/main/java/**/*.kt"
    ],
    android_resource_dirs: [
        "app/src/main/res"
    ],
    enabled: true
}

it's simple Hello World application without support libraries

class MainActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

and i have errors:

FAILED: out/soong/build.ninja 
out/soong/.bootstrap/bin/soong_build  -t -b out/soong -d 
out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "core-libart"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "core-oj"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "core-libart"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "ext"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "framework"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "okhttp"
error: packages/apps/AmpKotlinTest/Android.bp:4:1: "AmpKotlinTest" depends on undefined module "framework-res"
ninja: build stopped: subcommand failed.


as i understand, soong did not know about all this libraries, because they was compiled by *.mk files. yes?


On Tuesday, January 16, 2018 at 5:16:29 PM UTC-5, Colin Cross wrote:
This will eventually work using an android_app module in an Android.bp file for your system app with Kotlin sources, and may work today, but should not be considered fully supported yet.  If your system app has any dependencies, especially android-support-*, you will likely find that those do not yet work in Android.bp files.
On Tue, Jan 16, 2018 at 1:31 AM, Himanshu Mistri <mistrih...@gmail.com> wrote:
Hello ,

I understand that currently we can not able to write kotlin code for android framework, But what about putting my own developed kotlin app into  path like this (https://android.googlesource.com/platform/packages/apps/Contacts/) and get build it within android os so that my all will come as a system app.Where app source code will be written in kotlin and include it as system app.

Any advice or help will be great to move ahead.

Thanks,
Himanshu


On 5 January 2018 at 03:34, Colin Cross <ccr...@android.com> wrote:
Kotlin is not supported in Android.mk, and will likely never be.  It is supported by the build system in java_library and android_app modules defined in Android.bp files, but both kotlin support and Android.bp support for java is still relatively rudimentary.  We are not yet accepting any Kotlin code that gets installed on the device, but we have used it in a few places for tools on the host, e.g. https://android-review.googlesource.com/c/platform/frameworks/base/+/570862 and https://android-review.googlesource.com/c/platform/system/tools/hidl/+/516520.
On Thu, Jan 4, 2018 at 7:10 AM, <mykola.n...@motorolasolutions.com> wrote:
I am also interested in this question. Is it possible to use a kotlin in aosp development?
Can I compile kotlin sources with Android.mk? How?

On Monday, January 1, 2018 at 10:40:34 AM UTC-5, Jonathan Marsaud wrote:
Hi,

I would like to know if AOSP is planning to accept Kotlin contribution for the framework API classes.
I'm not talking about rewritting, but just profits of the interoperability of Kotlin to write new AOSP classes in this language.
If not, what are the cons?

Have a nice day and a happy new year!

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.



--

Thanks & Regards

Himanshu Mistri

Software Engineer 

+91-8460514154
+91-8758468857

mistrihimanshu...@gmail.com

Skype id : herry4003

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.

Kartik Aiyer

unread,
May 28, 2018, 3:56:59 PM5/28/18
to android-platform
Has there been any updates on this issue. I'm interested in trying the same thing. ie. We are building an android device and we want to install an app in the AOSP build that will be included as default. I'm okay with building the artifacts outside of the AOSP build as long as I can reliably embed the application and give it access to certain peripherals (its a camera so would like access to the camera server). 
Thanks
Kartik
Reply all
Reply to author
Forward
0 new messages