Краткое описание проекта: песочница для экспериментов с нативной частью Android в React Native.
-
Install requirements on Windows:
Required for emulator to work and for project to be flashed onto the virtual/physical device-
Java Development Kit
- Download java installer and run:
https://download.oracle.com/java/25/latest/jdk-25_windows-x64_bin.msi
- Download java installer and run:
-
Android Command Line Tools
- Create a directory dedicated to Android sdk. Recommended path:
C:/Users/<user>/Android/sdk. All the follwing instructions assume that you used the recommended path. - Download Command Line Tools package for Windows from https://developer.android.com/tools
- Extract the archive into the sdk directory
- Create a
latestsubdirectory and rearrange the files to forn the following structure:
C:/Users/<user>/Android/sdk/cmdline-tools/latest ├── NOTICE.txt ├── bin ├── lib └── source.properties
- Create a directory dedicated to Android sdk. Recommended path:
-
Environment
- Get into Windows Environment Variables Settings (naming might vary)
- In User variables section create new variable named
ANDROID_HOMEand put the path to sdk folder as its value (e.g.%USERPROFILE%\Android\sdk) - Double click on
Pathvariable to edit its contents. Add three entries in the list:
%ANDROID_HOME%\cmdline-tools\latest\bin%ANDROID_HOME%\platform-tools%ANDROID_HOME%\emulator
-
Android Platform Tools (adb)
- Use sdkmanager (part of cmdline-tools) in windows terminal to install platform-tools:
sdkmanager "platform-tools"
- Use sdkmanager (part of cmdline-tools) in windows terminal to install platform-tools:
-
Emulator
- Use sdkmanager (part of cmdline-tools) in windows terminal to install emulator:
sdkmanager "emulator" - User advmanager (android virtual device manager) to install kernel for emulator:
sdkmanager "system-images;android-36;google_apis;x86_64"
where:
android-36- depicts Android 16x86_64- depicts the hardware architecture (PC in our case)google_apis- if google services have to be included
- Create system image for the emulator based on the downloaded kernel:
avdmanager create avd -n "<name>" -k "system-images;android-36;google_apis;x86_64" --device "pixel_9"
where:
-n "<name>"- gives the image a name-k "system-images;android-36;google_apis;x86_64"- selected the kernel--device "pixel_9"- selects the hardware profile, in this case the one used for Google Pixel 9
- To run the emulator use:
emulator -avd <name>
- Use sdkmanager (part of cmdline-tools) in windows terminal to install emulator:
-
-
Install requirements on WSL:
Required for project building and flashing utilities to work-
Java Development Kit
- Run
sudo apt update && sudo apt install -y openjdk-17-jdkto install java - Make sure openjdk-17 is used by running
java --version - If some other version shows up use
sudo update-alternatives --config javato select the proper version
- Run
-
Android Command Line Tools
- Create a directory dedicated to Android sdk. Recommended path:
/home/<user>/Android/sdk. All the follwing instructions assume that you used the recommended path. - Download Command Line Tools package for Linux from https://developer.android.com/tools
- Extract the archive into the sdk directory
- Create a
latestsubdirectory and rearrange the files to forn the following structure:
/home/<user>/Android/sdk/cmdline-tools/latest ├── NOTICE.txt ├── bin ├── lib └── source.properties
- Create a directory dedicated to Android sdk. Recommended path:
-
Environment
- Open
~/.bashrcand add the following lines to its end:export ANDROID_HOME="/home/<user>/Android/sdk"export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/binexport PATH=$PATH:$ANDROID_HOME/platform-toolsexport PATH=$PATH:$ANDROID_HOME/emulator
- Open
-
Android Platform Tools (adb)
required to flash the application from the building side (WSL)- Use sdkmanager (part of cmdline-tools) in wsl terminal to install platform-tools:
sdkmanager "platform-tools"
- Use sdkmanager (part of cmdline-tools) in wsl terminal to install platform-tools:
-
Node.js - javascript compiler
required for project setup and javascript usage- install NVM - node version manager
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash. - Create new terminal or new shell
- install nodejs lts througn nvm:
nvm install --lts
- install NVM - node version manager
-
Additional requirements
- Make sure you have CMake installed
- Run
sudo apt update && sudo apt install -y ninja-buildto install ninja
-
-
Create react-native project using Expo framework
- Run:
npx create-expo-app@latest --template bare-minimum
It will prompt you asking to install create-expo-app package and then will ask you for the project name.
A new directory will be areated wit the entered name with the following project structure:
. ├── App.js ├── README.md ├── android │ ├── app │ │ ├── build │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ ├── debug │ │ ├── debugOptimized │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ └── sandbox │ │ │ ├── MainActivity.kt │ │ │ └── MainApplication.kt │ │ └── res │ ├── build │ ├── build.gradle │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── index.js ├── metro.config.js └── package.jsonFurther project structure explanation requires more android app lifecycle knowledge that might be covered during the next call meeting discussion.
- Run: