Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullable qualifier, and build #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sleekweasel
Copy link

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)

@kvafy
Copy link
Collaborator

kvafy commented Jul 18, 2019

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.

@sleekweasel
Copy link
Author

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.

@sleekweasel
Copy link
Author

sleekweasel commented Jul 18, 2019

@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.

@sleekweasel sleekweasel force-pushed the fix_nullable_qualifier branch from 965007a to 7e6ac8b Compare July 18, 2019 12:50
@plecesne
Copy link
Contributor

I suspect a difference in the regexp parser.

@sleekweasel What environment are you running on? OS, JDK version, ...

@sleekweasel
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants