`easy-installer` file from `easyInstaller-mac.zip` hangs when calling `adb devices`
easy-installer
Summary
On MacOs, building the easy installer using the project gradlew
, produces zip files containing the installer and it's dependencies (adb
, java
etc)
If you unpack the zip file and run the file bin/easy-installer
, the program runs, up to the Device detection screen
. It will fail to detect any connected devices.
The problem
Steps to reproduce
- Build the project from the project root directory:
$ ./gradlew dist
gradlew
runs and produces three zip files in the build/distributions
directory
- Unpack the
easyInstaller-mac.zip
and run the extractedeasy-installer
file
$ cp build/distributions/easyInstaller-mac.zip ~/temp/
$ cd ~/temp
$ unzip easyInstaller-mac.zip
$ easy-installer-mac/bin/easy-installer
The installer app runs (and logger output appears in the terminal window from which the app was run)
- (Optional) Connect a device which has USB debugging enabled (follow the instructions in the earlier screens if yours doesn't)
What is the current behavior?
Nothing happens. The program hangs, though it can be terminated using the red close
button, or by pressing <cmd>+q
Also notice that the last line of logger output is
`18:32:27.907 [Thread-4] DEBUG ecorp.easy.installer.models.Command - getFinalCmd(), Splitted command = /Users/pete/temp/easy-installer-mac/bin/adb/adb devices -l
and nothing more is output until the program is terminated
What is the expected correct behavior? The correct behaviour can be seen if (from the project root directory) you run the built binary from the build directory
build/image/easy-installer-mac/bin/easy-installer
This works as expected:
If you have connected a device, then the program should move to the next screen showing details of the connected device. This will be reflected in the logger output.
If you have not connected a device, the logger output will show repeated calls to adb devices
along with the returned empty device list.
Technical informations
The program seems to be hanging in the Command.execAndReadOutput()
method, somewhere in the following lines (after the call to getFinalCmd()
, before the logger
call
pb = new ProcessBuilder(getFinalCmd());
}
pb.redirectErrorStream(true);
pc= pb.start();
logger.info("Command's Process started");
Relevant logs (adb logcat
)
Interesting bits from the logger output of the failing run
...
OS name = Mac OS X
Java Home = /Users/pete/temp/easy-installer-mac
Current working dir = /Users/pete/temp
ADB folder path = /Users/pete/temp/easy-installer-mac/bin/adb/
...
18:36:44.903 [JavaFX Application Thread] INFO e.e.i.c.s.DeviceDetectedController - startDetection()
18:36:44.922 [Thread-4] INFO e.e.i.tasks.DeviceDetectionTask - runADBDevicesCmd(/Users/pete/temp/easy-installer-mac/bin/adb/adb)
18:36:44.928 [Thread-4] DEBUG ecorp.easy.installer.models.Command - getFinalCmd(), Splitted command = /Users/pete/temp/easy-installer-mac/bin/adb/adb devices -l
The interesting bits from the log of the successful run
19:04:50.772 [JavaFX Application Thread] DEBUG ecorp.easy.installer.EasyInstaller -
OS name = Mac OS X
Java Home = /Users/pete/easy-installer/build/image/easy-installer-mac
Current working dir = /Users/pete/easy-installer
ADB folder path = /Users/pete/easy-installer/build/image/easy-installer-mac/bin/adb/
...
19:05:10.608 [Thread-5] INFO e.e.i.tasks.DeviceDetectionTask - runADBDevicesCmd(/Users/pete/easy-installer/build/image/easy-installer-mac/bin/adb/adb)
19:05:10.610 [Thread-5] DEBUG ecorp.easy.installer.models.Command - getFinalCmd(), Splitted command = /Users/pete/easy-installer/build/image/easy-installer-mac/bin/adb/adb devices -l
19:05:10.618 [Thread-5] INFO ecorp.easy.installer.models.Command - Command's Process started
19:05:10.624 [Thread-5] DEBUG ecorp.easy.installer.models.Command -
(debug)List of devices attached
Solutions
This is only a problem if the Mac version of the installer is going to be delivered by means of the built zip file. See this forum post and any replies for the discussion around this subject.
I haven't dug any deeper, as it is not known what the ‘official’ way of making production Mac builds will be. No point debugging the gradlew
builds if production builds are made a different way.
Possible fixes
Sorry, no idea :)