Need advice about Java and Android versions and API levels for making a mobile game
Hiya,
I started making a very simple and lightweight 2D autoscroller mobile game and was just wondering about which Android version, and thus, which Java version and Android API level, should I target for a healthy dose of backwards compatability to maximize my potential customerbase without inconveniencing myself too much as a newbie developer? I'm aiming to make it as lightweight in terms of CPU, GPU, and RAM requirements and installation size as possible so that even older and cheaper Android phones on slower Internet connections are able to download, install and run it without a hitch. To my understanding, Intellij IDEA uses Jetbrains' own implementation of Java 17 by default, but according to my few Google searches on the topic, even the newest released Android, version 13, still uses Java 11, as does the previous Android, version 12. Am I able to make backwards compatible Android apps and games with Java 17 in IDEA or should I just download some older OpenJDK, like 11 or 8 for example, and use that instead? According to various market share statistics sites I found through a Google search, a whopping 10% of Android users are (allegedly) still on version 9, which uses Java 8 and API level 28. I mean, how do Android developers even ensure any kind of backwards compatability in general in this kind of market where the new Android versions come and go so fast, which leaves older phones without any support for newer Android versions?
请先登录再写评论。
Hello, DeveloperDave1337. Please, note that the JetBrains Runtime version used for running our IDEs as Java applications isn't related to the JDK version used for development; you can use any JDK you need.
Regarding the API level question, we have an interactive API version distribution dialog in the IDE as one of the steps of Android project creation:
File | New | Project…wizard;After that, you'll see the following window; all sections on the left are clickable:
However, I'd recommend you ask the same question on one of the Android developers' forums or on Stack Overflow, for example.
Hello again, and thankyou for your fast reply. As to your answer regarding using the project creation wizard to set the target Android API level, I am unable to do so as I am using a project created with the LibGDX framework project creator utility which creates you a ready-made project structure with a gradle file that you can just “open as project” in IDEA and it has all the libraries imported and set up for you from the getgo. I am using the LibGDX framework to streamline rendering graphics, playing back audio files, monitoring inputs, and ensuring crossplatform compatibility as I want to be able to easily debug on the same Windows PC I am using for the development without needing a hefty Android emulator, and also I want to release an iOS port in the future aswell. Is there a way to set the target API level within the project's settings after its creation?
I found a setting within the Project Structure settings which lets you choose your SDK and your language level. Will choosing an old enough language level ensure backwards compatibility with older Android devices or is targetting the proper API level enough?
You can set up the Android SDK version in the
File | Settings | Languages & Frameworks | Android | Android Project Structurewindow:Don't forget to specify it in the configuration files of the build tool you use.
Does the language level in Project Structure settings affect backwards compatibility at all or is it purely for which syntax I wish to use?
As you can see, the field is called Compile SDK version, it indicates not the language level (the syntax you use), but the API level used for compilation.