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

NullPointerException while installing with bundle-tool #49

Closed
devjta opened this issue Feb 7, 2019 · 7 comments
Closed

NullPointerException while installing with bundle-tool #49

devjta opened this issue Feb 7, 2019 · 7 comments

Comments

@devjta
Copy link

devjta commented Feb 7, 2019

Describe the bug
When trying to install the generated APKs from the AAB, the bundle-tool is not able to install it with Android 4.2 and 4.3 (never tested with 4.4).
Android >= 5.0 are working fine (the SAME files).

Bundletool version(s) affected
Version: [e.g. 0.8.0]

Stacktrace
[BT:0.8.0] Error: null
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at com.google.common.base.Joiner.toString(Joiner.java:454)
at com.google.common.base.Joiner.appendTo(Joiner.java:106)
at com.google.common.base.Joiner.appendTo(Joiner.java:154)
at com.google.common.base.Joiner.join(Joiner.java:197)
at com.google.common.base.Joiner.join(Joiner.java:187)
at com.google.common.base.Joiner.join(Joiner.java:205)
at com.android.ddmlib.Device.installRemotePackage(Device.java:1024)
at com.android.ddmlib.Device.installPackage(Device.java:902)
at com.android.ddmlib.Device.installPackage(Device.java:880)
at com.android.ddmlib.Device.installPackage(Device.java:869)
at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:113)
at com.android.tools.build.bundletool.device.ApksInstaller.installOnDevice(ApksInstaller.java:94)
at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:82)
at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:44)
at com.android.tools.build.bundletool.commands.InstallApksCommand.lambda$execute$3(InstallApksCommand.java:166)
at com.android.tools.build.bundletool.io.TempFiles.lambda$withTempDirectory$0(TempFiles.java:68)
at com.android.tools.build.bundletool.io.TempFiles.withTempDirectoryReturning(TempFiles.java:52)
at com.android.tools.build.bundletool.io.TempFiles.withTempDirectory(TempFiles.java:71)
at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:144)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:88)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)

To Reproduce
At least our app with 3rd party libs is not able to install it via bundle-tool on Android <5 (4.2 and 4.3 tested).
It works fine, when the same AAB file is uploaded into the store (minimum version of our app is 4.2).

Expected behavior
It should install the apk like it install it from the PlayStore.

@plecesne
Copy link
Contributor

plecesne commented Feb 7, 2019

Looks like a bug in an old version of ddmlib. We'll update the version to fix the bug properly in bundletool.

A workaround should be to pass the flag --allow-downgrade to bundletool. Can you try and report if that fixes it for you?

@devjta
Copy link
Author

devjta commented Feb 7, 2019

Yeah, this workaround worked perfectly. Can install it with bundletool now. Thanks for the fast reply.

@Beardemon
Copy link

The same bug at my Android 4.4 device
Bundletool Version:0.9.0

@Beardemon
Copy link

Now use the flag --allow-downgrade to bundletool , can install apks . Thanks very much.

@sampalmer
Copy link

sampalmer commented Jun 15, 2019

I was directed here from #79.

I have tried using --allow-downgrade when installing to an Android emulator running Android 4.0 through 4.4, but I now get a different error:

C:\Users\sam__\Desktop>java -jar C:\Utilities\bundletool\bundletool-all-0.9.0.jar install-apks --apks=64.apks --allow-downgrade
The APKs have been extracted in the directory: C:\Users\sam__\AppData\Local\Temp\5275980875689640840
[BT:0.9.0] Error: Installation of the app failed.
com.android.tools.build.bundletool.model.exceptions.InstallationException: Installation of the app failed.
        at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:47)
        at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:41)
        at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:122)
        at com.android.tools.build.bundletool.device.ApksInstaller.installOnDevice(ApksInstaller.java:94)
        at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:82)
        at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:44)
        at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:165)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:88)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
Caused by: com.android.ddmlib.InstallException: Unknown failure (2 [external]: Install on external media)
        at com.android.ddmlib.Device.installRemotePackage(Device.java:1031)
        at com.android.ddmlib.Device.installPackage(Device.java:902)
        at com.android.ddmlib.Device.installPackage(Device.java:880)
        at com.android.ddmlib.Device.installPackage(Device.java:869)
        at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:113)
        ... 6 more

@figengungor
Copy link

I had the same issue with @devjta and then used --allow-downgrade flag and this time had the issue @sampalmer mentioned.

Here is mine:

bundletool install-apks --apks=/Users/figengungor/Desktop/app.apks --allow-downgrade

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/usr/local/Cellar/bundletool/0.10.0/libexec/bundletool-all-0.10.0.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The APKs have been extracted in the directory: /var/folders/_h/08p9wxj16cn9v50qvx7p07r80000gq/T/13846039056705983555
[BT:0.10.0] Error: Installation of the app failed.
com.android.tools.build.bundletool.model.exceptions.InstallationException: Installation of the app failed.
	at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:47)
	at com.android.tools.build.bundletool.model.exceptions.InstallationException$Builder.build(InstallationException.java:41)
	at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:122)
	at com.android.tools.build.bundletool.device.ApksInstaller.installOnDevice(ApksInstaller.java:94)
	at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:82)
	at com.android.tools.build.bundletool.device.ApksInstaller.installApks(ApksInstaller.java:44)
	at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:165)
	at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:88)
	at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
Caused by: com.android.ddmlib.InstallException: Unknown failure (2 [external]: Install on external media)
	at com.android.ddmlib.Device.installRemotePackage(Device.java:1031)
	at com.android.ddmlib.Device.installPackage(Device.java:902)
	at com.android.ddmlib.Device.installPackage(Device.java:880)
	at com.android.ddmlib.Device.installPackage(Device.java:869)
	at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:113)
	... 6 more

I'm able to install to the device with Android version 8.0.0

I'm having the described issue when trying to install to the device with Android version 4.1.2.

Any idea? @plecesne

@ymakhno
Copy link
Collaborator

ymakhno commented Jun 29, 2021

Obsolete.

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

No branches or pull requests

6 participants