Struggling with 'meteor run android'

Hi all, I’d like to build my first mobile app using Meteor, but unfortunately am having some trouble with meteor run android . So far, when I run this command and my Android emulator is opened. I either see nothing but a standard Android home screen or the the message “Unfortunately Launcher3 has stopped working” .

As I’m new to Cordova and Android development. I realize I’m biting off a lot. However, I’m confident that I’m up for the challenge!

My hope is to identify one or two of the following resources :

  • A git repo for me to clone, execute, and compare with my project
    or
  • The commands that might let me interrogate my environment as it relates to AVD, Cordova, etc.

Here are some details about my environment :

my-laptop:simple-todos me$ $ANDROID_HOME/tools/android list avd
Available Android Virtual Devices:
    Name: my-avd
  Device: Nexus 4 (Google)
    Path: /Users/me/.android/avd/my-avd.avd
  Target: Android 6.0 (API level 23)
 Tag/ABI: default/x86_64
    Skin: 768x1280
my-laptop:simple-todos me$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
my-laptop:simple-todos me$ meteor --version
Meteor 1.4.1.1

I’m following this tutorial and I’m on step 6. Any help would be especially appreciated!

1 Like

Sorry all, I think I’ve found something :smiley:

git clone https://github.com/meteor/leaderboard
cd leaderboard
meteor run android

Will report my findings, but there’s clearly a compiler running in the background now. Android emulator has come up, but nothing interesting has happened yet.

I only get about 1-3 hours per week for my side projects, so apologies for running long on this topic. That said, I’m committed to resolving this issue and marking this thread as “FIXED”.

I’m ashamed to admit that I just found the --verbose flag for meteor run android and (obviously) this gives me more detail about what’s happening under the hood.

Ok, so I’m working with the leaderboard to get spun up, and here’s my environment :

my-laptop:leaderboard me$ android list avd
Available Android Virtual Devices:
    Name: my-avd
  Device: Nexus 4 (Google)
    Path: /Users/me/.android/avd/my-avd.avd
  Target: Android 6.0 (API level 23)
 Tag/ABI: default/x86_64
    Skin: 768x1280
my-laptop:leaderboard me$ meteor --version 
Meteor 1.3.4.4 

The first time I ran, with verbose, I had this result :

* What went wrong:
A problem occurred configuring root project 'android'.
> failed to find Build Tools revision 24.0.1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.982 secs
Error code 1 for command: /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/platforms/android/build.gradle,-PcdvBuildArch=x86,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true undefined
=> Errors executing Cordova commands:         
                                              
   While running Cordova app for platform Android with options --emulator:
   Error: Command failed: /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/platforms/android/cordova/run --emulator
   
   at ChildProcess.exitCallback (/tools/utils/processes.js:151:23)
   at ChildProcess.emit (events.js:98:17)
   at Process.ChildProcess._handle.onexit (child_process.js:820:12)
                                              
/Users/me/.meteor/packages/meteor-tool/.1.3.4_4.yd8cgw++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
      throw error;
            ^
ExitWithCode:1

Comparing this error against a discussion on StackOverflow leads me to believe I need to install Build Tools 24.0.1 . The arguments are a bit different, but at this point 24.0.1 is option #5 and the command looks like this :

android update sdk -a -u -t 5

After reinstalling the Android SDK tools, I again run Meteor :

my-laptop:leaderboard me$ meteor run android --verbose
Getting installed version for platform android in Cordova project
Getting installed version for platform ios in Cordova project
Checking Cordova requirements for platform Android
[[[[[ ~/Desktop/github/me/tutorials/leaderboard ]]]]]

=> Started proxy.                             
=> Meteor 1.4.1.1 is available. Update this project with 'meteor update'.
=> Started MongoDB.                           
Local package version is up-to-date: allow-deny@1.0.5
Local package version is up-to-date: autopublish@1.0.7
Local package version is up-to-date: autoupdate@1.2.11
Local package version is up-to-date: babel-compiler@6.8.4

(trimming large amount of output)

% updated project successfully                
% Executing "after_prepare"  hook for all plugins.
Running Cordova app for platform Android with options --emulator
ANDROID_HOME=/Users/me/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
=> Started your app.                          
                                              
=> App running at: http://localhost:3000/     
No emulator specified, defaulting to my-avd  -
Waiting for emulator...
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
emulator: WARNING: Setting VM heap size to 476MB
Hax is enabledp on Android Emulator          \
Hax ram_size 0x77300000
HAX is working and emulator runs in fast virt mode.
console on port 5554, ADB on port 5555       \

Unfortunately, the app still doesn’t launch. The emulator launches and shows a typical Android home screen :

I work with many Java environments, so I decide to validate my assumptions :

my-laptop:leaderboard me$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

Although JAVA_HOME points to Java 1.8, maybe java on my path is part of the issue? Let’s fix that.

my-laptop:leaderboard me$ jenv local 1.8
my-laptop:leaderboard me$ java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Ok, so now we have the proper Java version, let’s run it again


my-laptop:leaderboard me$ meteor run android --verbose
Getting installed version for platform android in Cordova project
Getting installed version for platform ios in Cordova project
Checking Cordova requirements for platform Android
[[[[[ ~/Desktop/github/me/tutorials/leaderboard ]]]]]

=> Started proxy.                             
=> Meteor 1.4.1.1 is available. Update this project with 'meteor update'.
=> Started MongoDB.                           
Local package version is up-to-date: allow-deny@1.0.5
Local package version is up-to-date: autopublish@1.0.7
Local package version is up-to-date: autoupdate@1.2.11

(trimming large amount of output)

% copying image from /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/resources/android_xhdpi_landscape.splash.png to /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/platforms/android/res/drawable-land-xhdpi/screen.png
% updated project successfully                
% Executing "after_prepare"  hook for all plugins.
Running Cordova app for platform Android with options --emulator
ANDROID_HOME=/Users/me/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
=> Started your app.                          
                                              
=> App running at: http://localhost:3000/     
No emulator specified, defaulting to my-avd  -
Waiting for emulator...
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
emulator: WARNING: Setting VM heap size to 476MB
Hax is enabledp on Android Emulator          -
Hax ram_size 0x77300000
HAX is working and emulator runs in fast virt mode.
console on port 5554, ADB on port 5555       \
   Starting app on Android Emulator          |

Unfortunately, still no “leaderboard” displayed when the emulator starts :

`

At this point, I figured, what the heck, lets update to Meteor 1.4.1.1 and see if that makes a difference.

my-laptop:leaderboard me$ meteor update
                                              
Changes to your project's package version selections from updating the release:
                                              
babel-compiler         upgraded from 6.8.4 to 6.9.1
babel-runtime          upgraded from 0.1.9_1 to 0.1.11
ecmascript             upgraded from 0.4.7 to 0.5.8
ecmascript-runtime     upgraded from 0.2.12 to 0.3.14
logging                upgraded from 1.0.14 to 1.1.15
meteor                 upgraded from 1.1.16 to 1.2.17
minifier-css           upgraded from 1.1.13 to 1.2.14
minifier-js            upgraded from 1.1.13 to 1.2.14
modules                upgraded from 0.6.5 to 0.7.6
modules-runtime        upgraded from 0.6.5 to 0.7.6
mongo                  upgraded from 1.1.9_1 to 1.1.12
npm-mongo              upgraded from 1.4.45 to 1.5.48
promise                upgraded from 0.7.3 to 0.8.4
standard-minifier-css  upgraded from 1.0.8 to 1.2.0
standard-minifier-js   upgraded from 1.0.8 to 1.2.0
tracker                upgraded from 1.0.14 to 1.1.0
webapp                 upgraded from 1.2.10 to 1.3.11

leaderboard: updated to Meteor 1.4.1.1.       
                                                                                   
Changes to your project's package version selections from updating package versions:
                                              
ddp-server    upgraded from 1.2.9 to 1.2.10   
npm-mongo     upgraded from 1.5.48 to 1.5.49
shell-server  added, version 0.2.1
templating    upgraded from 1.1.13 to 1.1.14

                                              
Newer versions of the following indirect dependencies are available:
 * autoupdate 1.2.11 (1.3.11 is available)    
 * caching-compiler 1.0.6 (1.1.7 is available)
 * ddp-client 1.2.9 (1.3.1 is available)      
 * ddp-server 1.2.10 (1.3.10 is available)    
 * http 1.1.8 (1.2.9 is available)            
 * templating 1.1.14 (1.2.14 is available)    
To update one or more of these packages, pass their names to 
`meteor update`, or just run `meteor update --all-packages`.

After updating Meteor, I run it again :

my-laptop:leaderboard me$ meteor run android --verbose
Getting installed version for platform android in Cordova project
Getting installed version for platform ios in Cordova project
Checking Cordova requirements for platform Android
[[[[[ ~/Desktop/github/me/tutorials/leaderboard ]]]]]

=> Started proxy.                             
                                              
Your development database is using mmapv1, the old, pre-MongoDB 3.0 database engine. You should consider upgrading to Wired Tiger, the new engine. The easiest way to do so in development is to run
meteor reset. If you'd like to migrate your database, please consult https://docs.mongodb.org/v3.0/release-notes/3.0-upgrade/
                                              
=> Started MongoDB.  

(trimming large amount of output)

copying image from /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/resources/android_xhdpi_landscape.splash.png to /Users/me/Desktop/github/me/tutorials/leaderboard/.meteor/local/cordova-build/platforms/android/res/drawable-land-xhdpi/screen.png
%% updated project successfully               
%% Executing "after_prepare"  hook for all plugins.
Running Cordova app for platform Android with options --emulator
ANDROID_HOME=/Users/me/Library/Android/sdk|
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
=> Started your app.                          
                                              
=> App running at: http://localhost:3000/     

No emulator specified, defaulting to my-avd  /

Waiting for emulator...
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
emulator: WARNING: Setting VM heap size to 476MB
Hax is enabledp on Android Emulator          -
Hax ram_size 0x77300000
HAX is working and emulator runs in fast virt mode.
console on port 5554, ADB on port 5555       |
   Starting app on Android Emulator

Sadly, still no leaderboard application :


Sigh… time to give up for the evening.


Am I missing something obvious? Is there a magical command like meteor run android --and-launch-client ? Any help is greatly appreciated!

cc/ @robfallows

1 Like

I got it working with installing android studio and using that tool to install the dependencies as in the guide: https://guide.meteor.com/mobile.html#installing-prerequisites-android

The message I see in your console about missing emulator leads me to this direction. But you seem more knowledgeable on Java so maybe there is a reason you have it different. As meteor integrates with those tools you might want to use a vm so you don’t get conflicts with existing Java installs and paths. Then you have a more standard environment to debug.

Did you try running in a device with meteor run android-device? So you can filter whether it’s an emulator issue or a bigger issue?

2 Likes

I’m in the exact same boat and can’t figure out why. Going to try a few more things tomorrow.

@blong I got mine to work today, but I switched to using Genymotion instead of the built in emulators.

This article was helpful in troubleshooting. It’s really just a matter of getting a device running in Genymotion, making sure ADB can see it (adb devices) and then doing meteor run android-device.

I had to step through some errors like updating JDK and setting App.setPreference('android-minSdkVersion', '18'); in my mobile-config.js file.

Let me know if you need some help.