4 ms·
Kind of an OT whine relative to the contents, but I'm still extremely frustrated at how hard it is to get other languages working on Android due to the multidex
by rtpg 10y ago
Kind of an OT whine relative to the contents, but I'm still extremely frustrated at how hard it is to get other languages working on Android due to the multidex-style issues.
Google should be spending millions being able to get app development up and running in something like Python. Have your app up and working in 2 minutes without having to learn Java. It boggles the mind that this isn't the case, and that the current tooling environment is soooo impossible to wrap ones mind around.
- distances 10y agoNah, they should just embrace Kotlin, even if it wouldn't solve the platform API issues. Java is not for this day and age, but frankly so wouldn't be Python.
- pjmlp 10y agoMany developers on the core Android team are former Sun employees and most likely very Java biased.
- GeneralTspoon 10y agoThe same could be said about any platform - e.g. why can't I write my iOS apps in python? Transpiling languages like that nearly always ends up messy, and adds another layer of potential bugs to the system. Taking the time to learn the platform will end up better in the long run (at least with the current state of transpilers). And as it stands, you can write Android apps with a native UI in Java, Kotlin, JS (React Native) and C# (Xamarin). And you if you want you can write business logic using any language that will compile to a C binary (using the NDK).
- rtpg 10y agoSo the multidex issue I was referring to makes it pretty hard to write things that will compile to C with the NDK. In order to get any access to the Android APIs, you have to do C-JDK bridging through JNI. And in android VMs, there's a hard limit on the number of symbols you can reference in the lifetime of an app. It's the equivalent of if python was like "yeah you can use the standard library, but only up to 100 functions!" iOS, since it goes through the LLVM framework stuff, doesn't have that many barriers to transpiling from other languages. You can just do raw function calls to the OS libs. But Android doesn't allow this, forces you to go through the JNI, and makes you have to work around this symbol limit.
- jventura 10y agoIn practical terms, you can only use frameworks like Kivy [1] to do UI on Android. But the result is completely non-native as Kivy renders its components on top of an openGL window. If you want to use Python and native UI components at the same time, you must run Python as a kind-of backend layer, where you call JNI functions from Java which will be redirected to the Python interpreter through C/C++. I have done this with an app that I have on the Play Store [2] which shares all non-UI code with a web app [3]. Even the charts are similar as they are generated as SVGs on my Python code. This architecture allows me to have native frontends on different platforms, and I have open-sourced PyBridge [4] to be used as starting point for everyone who wants to use something like this: basically, you send JSON messages from Java to Python with the name of a function and the arguments, and you get the response. [1] https://kivy.org/ https://kivy.org/ [2] https://play.google.com/store/apps/details?id=com.flatangle.charts https://play.google.com/store/apps/details?id=com.flatangle.... [3] http://elements.flatangle.com/ http://elements.flatangle.com/ [4] https://github.com/joaoventura/pybridge https://github.com/joaoventura/pybridge
- winter_blue 10y agoIs Java really that hard a language to learn? I've found, from experience[1], that large code bases written in statically typed languages like Java tend to be much more easier to read, understand -- which is extremely critical when working with a team. I use Python for a lot of my personal projects, but for a team project, I would rather use Java than Python. [1] Explained in detail here: https://news.ycombinator.com/item?id=12594616 https://news.ycombinator.com/item?id=12594616