Titanium JIRA Archive
Appcelerator Daemon (DAEMON)

[DAEMON-200] Android device not detected when plugged in after daemon start upon system restart

GitHub Issuen/a
Resolution Date2017-12-04T19:04:30.000+0000
Affected Version/sAppc Daemon 1.0.0
Fix Version/sAppc Daemon 1.0.0
Componentsandroidlib, appcd-plugin-android
ReporterSatyam Sekhri
AssigneeChris Barber


Steps to Reproduce: 1. Restart the system and make sure to plug out connected android device 2. Start Daemon 3. Run the command "/android/1.x/info". The devices section is blank as no device connected yet 4. Connect the device. 5. Again run the command "/android/1.x/info". Actual Result: The device section still shows blank and does not show the connected device. The device is shown in "appc ti info". Note: Repeating step 5 continues to give device as blank untill daemon is restarted. Find attached the daemon dump.




  1. Chris Barber 2017-12-04

    androidlib: https://github.com/appcelerator/androidlib/commit/0c58c695970ebd3833b32c1b2b58b3af5c313988 Appc Daemon master PR: https://github.com/appcelerator/appc-daemon/pull/216 Appc Daemon 1_0_X PR: https://github.com/appcelerator/appc-daemon/pull/217
  2. Lokesh Choudhary 2017-12-05

    I am still having issues with master.56. [~amukherjee],is having the same issue as well. 1. Disconnect the connected device/s. 2. Do a adb kill-server. 3. Do a adb start-server. 4. Connect the device. 5. Run appc appcd exec /android/latest/info/devices. 6. I get an empty array object. 7. Run appc appcd restart. 8. Run appc appcd exec /android/latest/info/devices. 9. Device is detected successfully.
  3. Chris Barber 2017-12-05

    Please attach a dump file immediately after reproducing the problem.
  4. Ewan Harris 2017-12-05

    [~lchoudhary] Am I right in assuming that prior to killing the adb server the daemon is running and the android info service has been exec'd once? I was able to reproduce if everything was running beforehand. [~cbarber] Looking at it I think that it's tangentially related to DAEMON-164, in that we don't reinit adb if we get a close event. Restart obviously works as we're resetting back to the beginning, a simple change like the below isn't pretty but fixes it in the short-term, alternatively I guess the info service could poll an adb.connect call from androidlib and call initDevices() when it gets a valid response to maybe make it less chatty
       diff --git a/plugins/appcd-plugin-android/src/android-info-service.js b/plugins/appcd-plugin-android/src/android-info-service.js
       index a271c38..c5ef498 100644
       --- a/plugins/appcd-plugin-android/src/android-info-service.js
       +++ b/plugins/appcd-plugin-android/src/android-info-service.js
       @@ -62,6 +62,9 @@ export default class AndroidInfoService extends DataServiceDispatcher {
        			.on('close', () => {
        				console.log('ADB connection was closed');
        				gawk.set(this.data.devices, []);
       +				setTimeout(async () => {
       +					await this.initDevices();
       +				}, 1000);
        			.once('error', err => {
        				console.log('Track devices returned error: %s', err.message);
  5. Lokesh Choudhary 2017-12-05

    [~eharris], yes I would assume so as I had studio running which was showing the devices, which means android info service would have been called by studio.
  6. Lokesh Choudhary 2017-12-05

    [~cbarber], here's the dump: [^dump.json] .

JSON Source