One, Android studio and Android SDK download
1.android Studio Download and install https://developer.android.com/studio/index.html
After downloading, andriod Studio will be installed automatically, and if you download the Canel, you should download it again. If not downloaded at the time of installation, then Preferences-appearance & behavior-system settings-android SDK Click Edit can also download
Second, JDK download and environment configuration
1. Download the JDK (address: http://www.java.com/zh_CN/) and install it, and after the installation, Mac view the JDK path/usr/libexec/java_home-v
/library/java/javavirtualmachines/jdk1.8.0_121.jdk/contents/home
2. Configure Environment variables
Go to Current user home directory, cd ~;(Default User directory is not required)
sudo su input password (temporary authorization)
3. Create the. bash_profile file, touch. Bash_profile (if present, do not create new, ignore this step)
4.open. Bash_profile
5. Enter the command below the JDK and note the value of the Java_home adjusted to your own directory
Java_home=/library/java/javavirtualmachines/jdk1.8.0_121.jdk/contents/home
classpaht=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Path= $JAVA _home/bin: $PATH:
Export Java_home
Export CLASSPATH
Export PATH
Export ANDROID_HOME=/USERS/LIJINSHI/LIBRARY/ANDROID/SDK
Export path= $PATH: $ANDROID _home/tools: $ANDROID _home/platform-tools
Save exit
6. Read and execute the command in the file: source. bash_profile, each time the modification is done to execute this sentence;
7. Enter Java-version in terminal to display the JDK information, then the configuration is successful.
Iii. Creation of Weex project
Weex Create HelloWorld
NPM Install
Weex Platform Add Android
Four, Android studio Open helloworld/platforms/android, waiting for Bilding ' Android ' Gradle project info, this step also has to wait a long time, is to let Android Studio installs Gradle. After opening, wait for the bottom right corner to go through the progress bar. Also if the message window shows a red text error, click on it to continue to have it pop-up windows installed. It took me more than 2 hours to get down this step.
Install the Android Simulator, find the tab in the toolbar, click, then you can choose the simulator device, and then the long wait.
Six, after the configuration of these, it is best to click the Run app to start a simulator try, start the emulator and then perform the next step.
Seven, Weex run Android, if the error message is environment variable $ANDROID _home not found!, go to the link of its prompt to see, find the corresponding solution. Https://stackoverflow.com/questions/19986214/setting-android-home-enviromental-variable-on-mac-os-x;
This step I also encountered the following error adb:failed to stat app/build/outputs/apk/playground.apk:no such file or directory, which is the output APK file name is not the same, Baidu to this article has been resolved https://www.jianshu.com/p/003bb3f12904. Then re-execute Weex run Android
Resources
Weex free video Tutorial-from getting started to presumptuous
Weex starting the Android emulator (MAC Environment)