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

Use adb in path by default #27

Closed
meizon opened this issue Sep 19, 2018 · 6 comments
Closed

Use adb in path by default #27

meizon opened this issue Sep 19, 2018 · 6 comments

Comments

@meizon
Copy link

meizon commented Sep 19, 2018

Describe the bug
adb must be passed to bundletool, is it possible that it could use the adb executable in my path.

Bundletool version(s) affected
Version: 0.6.0

Stacktrace
[BT:0.6.0] Error: Unable to determine the location of ADB. Please set the --adb flag or define ANDROID_HOME environment variable.

To Reproduce
Use bundletool without providing an adb

Expected behavior
It would default to the adb on my path

Environment:
OS: Linux

@plecesne
Copy link
Contributor

Could you set the environment variable ANDROID_HOME with the path to the SDK? Then, bundletool would be able to find adb in it.

@nfischer
Copy link

@plecesne it's common for our team (WebView and Chrome for Android) to use the adb binary in the $PATH (e.g., sudo apt-get install adb).

@nfischer
Copy link

@plecesne would you be open to a pull request for this feature?

@plecesne
Copy link
Contributor

Absolutely, we welcome contributions.

@adam-hurwitz
Copy link

adam-hurwitz commented Oct 6, 2018

Is there a simpler way to resolve this ANDROID_HOME path error?

For instance, I'm attempting to use Android's bundletool but am receiving the error:

Unable to determine the location of ADB. Please set the --adb flag or define ANDROID_HOME environment variable.

Attempted Command

bundletool-all-0.6.0.jar build-apks --bundle=/path/app.aab --output=/path/app.apks --ks=/path/coinverse-release.jks --ks-pass=file:/path/keyname.pwd --ks-key-alias="appname-release" --key-pass=file:/path/keystores/key.pwd --connected-device

Current Solution
By defining the ANDROID_HOME path in my .bash_profile for my Macbook Pro resolved the issue as described in this Stackoverflow post.

  1. cd ~
  2. ls -a (look to make sure .bash_profile is in the folder you are in)
  3. vi .bash_profile
  4. Add the following lines:
    export ANDROID_HOME={androidSdkPath} (ie: /Users/adamhurwitz/Library/Android/sdk/)
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Note: When attempting to use --adb in the path it does not work with the following error.

com.android.tools.build.bundletool.exceptions.CommandExecutionException: Failed to start ADB server.
        at com.android.tools.build.bundletool.device.DdmlibAdbServer.init(DdmlibAdbServer.java:81)
        at com.android.tools.build.bundletool.commands.BuildApksManager.getDeviceSpec(BuildApksManager.java:226)
        at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:91)
        at com.android.tools.build.bundletool.io.TempFiles.withTempDirectoryReturning(TempFiles.java:52)
        at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:379)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:73)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:44)

@lu769257351
Copy link

这问题有人知道怎么解决吗?我也遇到了

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

5 participants