Meteor run android-device error

Running Android SDK 25.2.3, per the mobile docs, but when I run meteor run android-device --mobile-server=https://myserver.com I get:

[[[[[ C:\Users\x\Desktop\my-android-app ]]]]]

=> Started proxy.
=> Started MongoDB.

WARNING: You are testing your app on a remote device. For the mobile app
		 to be able to connect to the local server, make sure your device
		 is on the same network, and that the network configuration allows
		 clients to talk to each other (no client isolation).
=> Errors executing Cordova commands:

   While running Cordova app for platform Android with options --device:
   Error: Command failed:
   C:\Users\x\Desktop\my-android-app\.meteor\local\cordova-build\platforms\androi
d\cordova\run
   --device --device
   { [Error: cmd: Command failed with exit code 1] code: 1 } 'Error: cmd:
   Command failed with exit code 1\n    at ChildProcess.whenDone
   (C:\\Users\\x\\Desktop\\my-android-app\\.meteor\\local\\cordova-build\\platfor
ms\\android\\cordova\\node_modules\\cordova-common\\src\\superspawn.js:169:23)\n

   at emitTwo (events.js:87:13)\n    at ChildProcess.emit
   (events.js:172:7)\n    at maybeClose
   (internal/child_process.js:854:16)\n    at
   Process.ChildProcess._handle.onexit
   (internal/child_process.js:222:5)'
   at ChildProcess.exitCallback (C:\tools\utils\processes.js:151:23)
   at emitTwo (events.js:87:13)
   at ChildProcess.emit (events.js:172:7)
   at Process.ChildProcess._handle.onexit
   (internal/child_process.js:211:12)
   => awaited here:
   at Function.Promise.await
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\isopackets\cordova-support\npm\node_modules\meteor\promise\node_modules
\meteor-promise\promise_server.js:35:12)
   at CordovaProject.runCommands (C:\tools\cordova\project.js:715:22)
   at CordovaProject.run$ (C:\tools\cordova\project.js:261:10)
   at tryCatch
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:63:40)
   at GeneratorFunctionPrototype.invoke [as _invoke]
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:337:22)
   at GeneratorFunctionPrototype.prototype.(anonymous function) [as next]
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:96:21)
   at tryCatch
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:63:40)
   at invoke
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:139:20)
   at
   C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.windows
.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:184:11
   at callInvokeWithMethodAndArg
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:183:16)
   at AsyncIterator.enqueue
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:206:13)
   at AsyncIterator.prototype.(anonymous function) [as next]
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:96:21)
   at Object.runtime.async
   (C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.window
s.x86_32\dev_bundle\lib\node_modules\regenerator-runtime\runtime.js:226:14)
   at
   C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.windows
.x86_32\isopackets\cordova-support\npm\node_modules\meteor\promise\node_modules\
meteor-promise\fiber_pool.js:32:39

C:\Users\x\AppData\Local\.meteor\packages\meteor-tool\1.4.3_2\mt-os.windows.x8
6_32\isopackets\cordova-support\npm\node_modules\meteor\promise\node_modules\met
eor-promise\promise_server.js:190
	  throw error;
	  ^
undefined
 => awaited here:
	at Function.Promise.await (C:\Users\x\AppData\Local\.meteor\packages\meteo
r-tool\1.4.3_2\mt-os.windows.x86_32\isopackets\cordova-support\npm\node_modules\
meteor\promise\node_modules\meteor-promise\promise_server.js:35:12)
	at C:\tools\cordova\runner.js:98:17
	at C:\tools\utils\buildmessage.js:271:13
	at [object Object]._.extend.withValue (C:\tools\utils\fiber-helpers.js:89:14
)
	at C:\tools\utils\buildmessage.js:264:29
	at [object Object]._.extend.withValue (C:\tools\utils\fiber-helpers.js:89:14
)
	at C:\tools\utils\buildmessage.js:262:18
	at [object Object]._.extend.withValue (C:\tools\utils\fiber-helpers.js:89:14
)
	at C:\tools\utils\buildmessage.js:253:23
	at [object Object]._.extend.withValue (C:\tools\utils\fiber-helpers.js:89:14
)
	at Object.capture (C:\tools\utils\buildmessage.js:252:19)
	at CordovaRunner.startRunTargets (C:\tools\cordova\runner.js:97:37)
	at [object Object]._.extend._runOnce (C:\tools\runners\run-app.js:777:21)
	at [object Object]._.extend._fiber (C:\tools\runners\run-app.js:890:28)
	at C:\tools\runners\run-app.js:417:12

Any idea what’s causing this? Or how to fix?

I don’t know the cause of this error but I few things you could try which have helped me in the past.

  1. Try building just the APK first. This will ensure all your local SDK’s and JAVA is installed correctly.
  2. Device plugged in? Cable working and can navigate to the file system on the device?
  3. Is the device detected? adb devices should return a device ID. If that returns no value then meteor run android-device will not work.

Thanks @ashhimself, #1 was the solution.

I was generating builds off a remote virtual machine without android support, but attempting meteor run androind-device on my local workstation with android support, hence I never got the error before when generating builds and meteor run android-device doesn’t output the same errors.

Once I ran meteor build /dir it revealed two errors:

  1. JAVA_HOME environment variable was set to C:\Program Files\Java\jdk1.8.0_121\bin instead of C:\Program Files\Java\jdk1.8.0_121
  2. Cryptically, it then said I had not accepted the license agreement of the Google Support Repository, even though the Android SDK Manager said that wasn’t installed, so I just installed it via that Windows GUI (accepting the license agreement)

With those fixed it all worked fine.

Thanks for your help…this is way better, more helpful and more polite than Stack Overflow.

Glad that solved your problem! Happy to help anytime.