Gradle version: 4.4
Android Plugin Version: 3.1.2
I’m working on an Android which should be deploy by using a Mobile Device Management called AirWatch.
So since Android Gradle Plugin 3.0.0, even if I update application version code and version name, the MDM thinks that the last deployed version and the current one are the same.
Using dump badging command, I see that the platformBuildVersionName is empty. So when I disable aapt2 from my gradle properties file, platformBuildVersionName is filled. which allow me to deploy on the MDM. The problem is not up to date we don’t when they will. So this is the work around I found. I know that the option ‘android.enableAapt2’ is deprecated and should not be used anymore.
My question is what’s the meaning “It will be removed at the end of 2018”? Is that mean, at the end of 2018, my app will not compile anymore?
The issue with platformBuildVersionName missing has been fixed recently in AAPT2.
AAPT2 it is now released it in GMaven for faster releases (so you need to have the google() dependency in your build.gradle file), so please try with android gradle plugin 3.2.0 alpha16 or newer which may already contain it. If that still doesn’t work, keep an eye out for new versions, it should be released shortly (if it hasn’t been yet).
As for the information about AAPT1 deprecation – it means that at some point in the near future, near the end of 2018, there will be a release of Android Gradle Plugin that removes the
android.enableAapt2=false flag. AAPT1 will be completely removed then so the hacks with disabling AAPT2 won’t work anymore. If you run into any other issues with AAPT2 please file them on issue tracker, so that the team can fix them before everyone will need to move away from AAPT1.
In 2019 New update
From Gradle.properties remove
android.enableAapt2=false this line
it will work now.
2.File-> settings-Build, Execution > Instant run
unselected all options and rebuild projects