meteor / simple-todos-react

A repository that follows the React tutorial step-by-step

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting meteor to build in android on windows (Tutorial step 6)

Rafael-Menis opened this issue · comments

It is possible to get meteor to build in android on windows. It's difficult, but possible. First, you need to follow the instructions here. To paraphrase, with points in brackets being outside comments-
Step 1- download and install JDK 1.8.something. [Do not install JDK 10- meteor doesn't work with it yet].
Step 2- download and install Android Studio.
Step 3- edit PATH (usually found under control panel) to include C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools and C:\Program Files\Java\jdk1.8.0_91\bin.
Step 4- create JAVA_HOME and set it to C:\Program Files\Java\jdk1.8.0_91. [An important point- make sure that this entry does not have /bin after it (credit to Stephen C). If it does, you'll get the error

Your system does not yet seem to fulfill all requirements to build apps for Android.

Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/mobile.html#installing-prerequisites

Status of the individual requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: avdmanager: Command failed with exit code 1 (issue 9510)

no matter what version of Java you have installed.]
Step 5-set ANDROID_HOME to C:\Users\USERNAME\AppData\Local\Android\sdk. [end of paraphrase]
Step 6- type meteor add-platform android into your terminal as in the tutorial. Do not type meteor run android yet unless you like more error messages.
Step 7- in the current version of Meteor (1.7), cordova will still crash horribly even after you have done all of these things. The key error line is "TypeError: Cannot read property 'semver' of null". It turns out that the version of cordova bundled with meteor doesn't like any android versions other than its target (credit to The Mighty Chris), and this can be fixed by

find the path <project_root>/platforms/android/cordova/lib/emulator.js
find the line avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
replace it with avd.target = 'Android ' + (level ? level.semver : '') + ' (API level ' + api_level + ')';
(credit to oidualc).

In meteor, you'll find the relevant emulator file at .meteor/local/cordova-build/platforms/android/cordova/lib/emulator.js.
Step 8- once you've done that, you can finally type meteor run android and be up and running!

It worked for me. Yay!!!!!!!!!!!!!!!

Hey @Rafael-Menis @chidimo , thank you for your feedback.

I have incorporated your feedback here in this new repo, the new home of react tutorial.

https://github.com/meteor/react-tutorial/ (https://react-tutorial.meteor.com)

It's PR friendly so if you want to make more changes, go ahead there!