Getting Started · React Native
-
Install Android Studio
-
Install the Android SDK
"SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 6.0
- Google APIs
- Android SDK Platform 23
- Intel x86 Atom_64 System Image
- Google APIs Intel x86 Atom_64 System Image
"SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that 23.0.1 is selected.
Applyをクリックする
.bash_profile
vi $HOME/.bash_profile
以下を追加する。
export ANDROID_HOME=/Users/atsu/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
確認
一度ターミナルを閉じて、再度表示。以下コマンドで環境変数を表示
echo $PATH
パスは以下で確認するパスと同じになっていればOK
Appearance & Behavior → System Settings → Android SDK.
/Users/atsu/Library/Android/sdk
AVD
Create Virtual Device...
Select the "x86 Images" tab, then look for the Marshmallow API Level 23, x86_64 ABI image with a Android 6.0 (Google APIs) target.
Click Finish!!
Running your React Native application
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
以下のように表示される場合にはandroid emuが起動していない時
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.i
以下のコマンドで動いてるエミュレーターを確認
adb devices
### emulatorを起動する
赤い画面が表示されたとき

console.error: "React Native version mismatch.
JavaScript version: 0.54.2
Native version: 0.55.3
Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`."
checkVersions
index.delta?platform=android&dev=true&minify=false:13945:20
<unknown>
index.delta?platform=android&dev=true&minify=false:12212:40
loadModuleImplementation
index.delta?platform=android&dev=true&minify=false:159:14
guardedLoadModule
index.delta?platform=android&dev=true&minify=false:84:47
_require
index.delta?platform=android&dev=true&minify=false:73:79
global code
index.delta?platform=android&dev=true&minify=false:122369:8
watchman watch-del-all
react-native start --reset-cache
react-native run-android