- ⭳ Download (APK)
- A React Native app which uses Expo's bare workflow.
- This app is part of a demonstration for an indoor positioning system (IPS) in supermarkets. The IPS relies on visible light communication (VLC) to determine the customers' relative positions in the supermarket.
- The app's features include:
- Viewing product listings
- 3D view of the supermarket layout with path visualizations
- Customer support chat
expo install [package_name]
to install a packageyarn remove [package_name]
to remove a packageexpo prebuild
to generate Android/IOS specific project filesexpo run:android
to test the app on an Android phone via USB.expo run:android --variant release
to test the minified app on an Android phone via USB.
- Generate APK file with EAS:
eas build -p android --profile preview
- Generate Android App Bundle (.aab):
eas build -p android --profile production
- Expo's free tier has a limited number of builds per month.
- Relevant links:
-
As discussed in Issue #1 and Issue #2, React Native's release build causes image files (
.jpg, .png, etc
) to be moved bygradlew
to the Android project's drawable assets folder and will possess a different URI scheme which expo-three's asset loader does not recognise. Hence, the map will fail to load properly. As a hacky solution, rename texture image extensions from.jpg
to.xjpg
. Likewise,.png
becomes.xpng
. The addition ofx
is arbitrary and to avoid the images from being affected by the different URI scheme. -
When loading a texture image, make sure to set its type, width and height as follows:
const textureAsset = Asset.fromModule(require("../../assets/textures/tiles.xjpg")); // Change this if (textureAsset.type === 'xjpg') { textureAsset.type = 'jpg'; // Use an image editor to find out the image dimensions textureAsset.width = 300; // Change this textureAsset.height = 300; // Change this }
-
Before building the release, clean the Android project:
cd android gradlew clean cd ..
-
Generate the Javascript bundle:
npx react-native bundle --platform android --minify true --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
-
Delete all
drawable-*
folders and also theraw
folder inandroid\app\src\main\res
. This is to address the duplicate resources issue as highlighted here. -
Build the APK:
cd android gradlew assembleRelease ..or.. gradlew assembleDebug
-
The release apk should be located at
android\app\build\outputs\apk\release
-
Install the APK with
adb install [apk_file_path]
-
View the phone's logs with
adb logcat
- In a normal React Native project without Expo, it should be possible to create a debug build without the dev server. In
android\app\build.gradle
, add the following:project.ext.react = [ ... bundleInDebug: true, // add this line, devDisabledInDev: true, // add this line, ]
- Generate the debug build with the following:
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
- However, it seems that it does not work in Expo even after ejecting it. I can't seem to get rid of Expo's dev client in debug builds 😔.