Welcome to the documentation for the React Native application! This guide will cover essential processes such as clearing cache, building the APK, and locating the built APK files.
Clearing the cache can resolve various issues that might arise during the development and testing of your React Native application. Follow these steps to clear the cache:
-
Clear Metro Bundler Cache:
To clear the Metro Bundler cache, run the following command in your project's root directory:
npx react-native start --reset-cache
-
Clear Android Build Cache:
If you're encountering issues related to the Android build, you can clear the Android build cache by running the following command:
cd android && ./gradlew clean
-
Clear iOS Build Cache:
For iOS, you can clear the build cache by deleting the
DerivedData
folder. The path is generally:~/Library/Developer/Xcode/DerivedData/
Delete the contents of the
DerivedData
folder.
Building the APK (Android Package) is an important step in preparing your React Native app for distribution or testing on Android devices. Here's how you can build the APK:
run yarn build:apk
or follow the steps below.
-
Navigate to the Android Directory:
Open your terminal and navigate to the
android
directory of your React Native project:cd android
-
Build the APK:
To build the APK, use the following Gradle command:
./gradlew assembleRelease
This command will trigger the build process and create the APK file.
-
Generated APK Location:
Once the build process is complete, you can find the generated APK file at the following location:
rise/android/app/build/outputs/apk/release/app-release.apk
After building the APK, you can easily locate the generated APK files using the file paths provided in the previous section:
- For release APK:
rise/android/app/build/outputs/apk/release/app-release.apk
Congratulations!.
For more in-depth information and troubleshooting, refer to the official documentation of React Native and Android Studio.
If you encounter any issues beyond the scope of this documentation, don't hesitate to seek help from the team lead.