Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Android Sandbox

Краткое описание проекта: песочница для экспериментов с нативной частью Android в React Native.


Requirements Installation

  • Install requirements on Windows:
    Required for emulator to work and for project to be flashed onto the virtual/physical device

    • Java Development Kit

    • 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 latest subdirectory and rearrange the files to forn the following structure:
        C:/Users/<user>/Android/sdk/cmdline-tools/latest
        ├── NOTICE.txt
        ├── bin
        ├── lib
        └── source.properties
        
    • Environment

      • Get into Windows Environment Variables Settings (naming might vary)
      • In User variables section create new variable named ANDROID_HOME and put the path to sdk folder as its value (e.g. %USERPROFILE%\Android\sdk)
      • Double click on Path variable 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"
    • 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 16
        • x86_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>
  • 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-jdk to install java
      • Make sure openjdk-17 is used by running java --version
      • If some other version shows up use sudo update-alternatives --config java to select the proper version
    • 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 latest subdirectory and rearrange the files to forn the following structure:
        /home/<user>/Android/sdk/cmdline-tools/latest
        ├── NOTICE.txt
        ├── bin
        ├── lib
        └── source.properties
        
    • Environment

      • Open ~/.bashrc and add the following lines to its end:
        • export ANDROID_HOME="/home/<user>/Android/sdk"
        • export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
        • export PATH=$PATH:$ANDROID_HOME/platform-tools
        • export PATH=$PATH:$ANDROID_HOME/emulator
    • 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"
    • 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
    • Additional requirements

      • Make sure you have CMake installed
      • Run sudo apt update && sudo apt install -y ninja-build to 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.json
    

    Further project structure explanation requires more android app lifecycle knowledge that might be covered during the next call meeting discussion.

About

Personal sandbox

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages