Android Studio 3.0 has officially been released, marking a new phase in our Android development. This is great, but significant breakthroughs always require painful migrations to enjoy them, which is expected.
Below I will highlight a few points to see if everyone has noticed them.
1. IDE and Build Plugin Upgrades
While we say that Android Studio is being upgraded, please note that the Android build plugin, also known as the Gradle plugin, is being upgraded too:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
The upgrade mentions many new features of the IDE, such as built-in Kotlin support (which is great), device file explorer, APK analyzer, etc. Note that these are all new features of the IDE, which are excellent and worth trying. However, it also mentions a significant improvement in build speed, which is mainly targeted at this plugin. If you just want to try out the new features of the IDE, do not upgrade the Gradle plugin version; using the previous version 2.2.3 or other versions will still allow you to develop.
Once again, if you only want to experience the new features of the IDE, to avoid hassle, do not rush to upgrade the Gradle plugin.
Why do I say this? Because I have seen some friends in the group say they encountered a lot of errors after upgrading and had to revert to using 2.3. Um… Can I say I’ve been switching between IDE versions 2.3 and 3.0 for the same project? As long as you don’t upgrade the Gradle plugin, your original project configuration will not have any issues.
2. Build Plugin Upgrade
As mentioned earlier, the build errors everyone encountered are mainly due to the upgrade of the build plugin, so please pay attention that this plugin is the Gradle plugin.
No pain, No gain.
This update has detailed the configuration requirements for the build dependency graph, which helps avoid many unnecessary builds. It can be imagined how significant the build speed improvement will be for some massive projects. Of course, if your project only has a few modules, this feature may not be very useful.
For specific Gradle migration, everyone should refer to the official documentation. Compared to other update notes, Google’s documentation is very practical and considerate: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
In simple terms, those who use productFlavor need to migrate, and all configured dependencies need to be updated to more detailed compile-time non-transitive dependencies (implementation) and compile-time transitive dependencies (api) as well as compile-time dependencies (compileOnly) and runtime dependencies (runtimeOnly).
Therefore, this plugin upgrade may have a significant impact on projects that use custom builds. For example, if we previously customized the build process or even hacked aapt, with this plugin upgrade, the build tools have undergone significant innovations. Thus, we must validate and synchronize updates for these tools before upgrading to the new version, which will be a painful process.
3. Kotlin Support
Honestly, the significance of this lies in the official attitude towards Kotlin rather than anything else. This update for Kotlin, from the IDE’s perspective, is just installing the Kotlin plugin for us; there don’t seem to be many other changes.
But this indicates that Google’s support for Kotlin is not just verbal but has practical actions. Well, don’t hesitate; hurry up and get on board. Isn’t the lesson from not buying a house last year enough?
Regarding Kotlin support, the real support should be to embed Kotlin’s standard library into the Android system. For example, maybe starting from Android 10.0, we won’t need to introduce kotlin-stdlibs separately when developing Android with Kotlin. Besides, we will no longer need to configure such things in Gradle:
apply plugin: "kotlin-android"
Using Kotlin for development should feel as natural as using Java. That would be wonderful. However, in the current situation, Java is still the “First Language”, while Kotlin and C++ can only be considered “First Class Languages”.
What do you need a bicycle for?
Regardless, this is already good news for Kotlin supporters.
4. Summary
Alright, that’s all for this update on Android Studio. As for the support for Java 8 new features, let’s not even talk about it.