为什么在Android上使用Java/Kotlin而不是Python?

2024-05-19 15:05:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新手。这就是为什么我不能理解使用Java/Kotlin和使用Python及其众多模块进行Android应用程序开发之间的本质区别。有没有充分的理由让Java/Kotlin成为更好的选择?请解释一下。你知道吗


Tags: 模块javaandroid理由新手kotlin本质区别
3条回答

如果你读Application Fundamentals,你会注意到-

Android apps can be written using Kotlin, Java, and C++ languages. The Android SDK tools compile your code along with any data and resource files into an APK, an Android package, which is an archive file with an .apk suffix. One APK file contains all the contents of an Android app and is the file that Android-powered devices use to install the app.

<> Kotlin、java和C++是官方支持的语言。使用除他们以外的任何语言都将是一个艰难的过程。基本上,android应用程序在虚拟机中运行。如果你想用python构建应用程序,那么你必须有一种方法将python代码转换成VM能够理解的字节码。恐怕有官方支持像科特林这样的转变。你知道吗

尽管this answer展示了如何使用python开发android应用程序,但您可能不会考虑使用python而不是Java/Kotlin,原因主要有以下两个:

  1. 官方支持。你知道吗
  2. 巨大的Jave/Kotlin社区。你知道吗

JavaKotlin是Android SDK的官方语言。 所以大家都用这些。另一方面,python用于跨平台应用程序。你知道吗

Google是Android的商业营销商,他们目前支持JavaKotlin作为Android开发的官方语言。这就是为什么大家都喜欢Java和Kotlin。你知道吗

还有一些其他语言mentioned here,也用于Android开发,比如C(Unity和Xamarin)。你知道吗

相关问题 更多 >