Fix nullable qualifier, and build
The tool had a NPE because it didn't like my emulators. I also had to change gradle.properties so it would build for me.
Exception in thread "main" java.lang.NullPointerException: Null qualifier
at com.android.tools.build.bundletool.model.version.AutoValue_Version$Builder.setQualifier(AutoValue_Version.java:119)
at com.android.tools.build.bundletool.model.version.Version.of(Version.java:79)
at com.android.tools.build.bundletool.model.version.BundleToolVersion.getCurrentVersion(BundleToolVersion.java:33)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:118)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
What do you mean by "emulators"? The BundleToolVersion.getCurrentVersion method internally parses a hard-coded constant (CURRENT_VERSION = "0.10.1"), so unless the constant was modified, I don't see how the parsing could fail.
I'm running a single emulator. I assumed it was that. Whatever the reason, if I run
git checkout 0.10.1
./gradlew clean
I get
$ ./gradlew clean
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '11.0.3'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
And if I fix
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
I can then continue with
./gradlew executablejar
java -jar ./build/libs/bundletool-all.jar get-device-spec
whereupon I get
)$ java -jar ./build/libs/bundletool-all.jar get-device-spec
Exception in thread "main" java.lang.NullPointerException: Null qualifier
at com.android.tools.build.bundletool.model.version.AutoValue_Version$Builder.setQualifier(AutoValue_Version.java:119)
at com.android.tools.build.bundletool.model.version.Version.of(Version.java:79)
at com.android.tools.build.bundletool.model.version.BundleToolVersion.getCurrentVersion(BundleToolVersion.java:33)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:118)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
unless I apply the patch.
@kvafy If I change CURRENT_VERSION from 0.10.1 to 0.10.1-anything then it doesn't NPE.
So nothing to do with my emulator, just that Auto_Value hasn't been told that 'qualifier' is allowed to be null. Or something like that.
I suspect a difference in the regexp parser.
@sleekweasel What environment are you running on? OS, JDK version, ...
I'm on $ java -version openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1) OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing)
I've changed the patch to just updating the versions as you suggested, and tweaking the 'shadow' declaration to use auto-value-annotations instead of just auto-value, which didn't work for me.