Complete step-by-step guide to set up the NativeBridge app with biometric authentication.
- macOS with Xcode installed
- Node.js >= 18
- Java JDK 17 (required for React Native 0.74.7)
- Android SDK and Android Studio
- React Native development environment set up
cd /Users/himanshukukreja/autoflow/NativeBridge
chmod +x setup.sh
./setup.shThis will automatically:
- Copy NativeBridgeApp source
- Update package names
- Install dependencies
- Update App.tsx with authentication gate
- Build the APK
- Copy APK to builds folder
cd /Users/himanshukukreja/autoflow
cp -R appium-test-scripts/android-test-apps/NativeBridgeApp NativeBridge
cd NativeBridgeUpdate the following files to change com.nativebridgeapp to com.nativebridge.io:
Android Manifest (android/app/src/main/AndroidManifest.xml):
sed -i '' 's/com.nativebridgeapp/com.nativebridge.io/g' android/app/src/main/AndroidManifest.xmlbuild.gradle (android/app/build.gradle):
sed -i '' 's/com.nativebridgeapp/com.nativebridge.io/g' android/app/build.gradleMainActivity.kt - Rename directory:
cd android/app/src/main/java/com
mv nativebridgeapp nativebridge
mkdir -p nativebridge/io
mv nativebridge/* nativebridge/io/
cd nativebridge/ioUpdate package in MainActivity.kt:
sed -i '' 's/package com.nativebridgeapp/package com.nativebridge.io/g' MainActivity.ktMainApplication.kt - Same directory, update package:
sed -i '' 's/package com.nativebridgeapp/package com.nativebridge.io/g' MainApplication.ktEdit android/app/src/main/res/values/strings.xml:
<resources>
<string name="app_name">NativeBridge</string>
</resources>cd /Users/himanshukukreja/autoflow/NativeBridge
npm install --legacy-peer-depsDependencies include:
- react-native@0.74.7
- react-native-biometrics@3.0.1
- react-native-camera@4.2.1
- react-native-document-picker@8.2.1
- react-native-fs@2.20.0
- @react-native-clipboard/clipboard@1.14.1
- react-native-safe-area-context@4.10.9
Replace the contents of App.tsx with the authentication-gated version provided in this repository. The key changes include:
- Add authentication state:
const [isAuthenticated, setIsAuthenticated] = useState(false);
const [isAuthenticating, setIsAuthenticating] = useState(false);
const [authError, setAuthError] = useState('');- Add useEffect hook to trigger authentication on launch:
useEffect(() => {
checkAndAuthenticateOnLaunch();
}, []);- Add conditional rendering to show auth screen or main app
See App.tsx in this repository for the complete implementation.
Ensure android/app/src/main/AndroidManifest.xml includes:
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />If you have a PNG logo, convert it to Android mipmap formats:
# Place your logo.png in the NativeBridge folder
# Then run ImageMagick commands:
magick logo.png -resize 48x48 android/app/src/main/res/mipmap-mdpi/ic_launcher.png
magick logo.png -resize 72x72 android/app/src/main/res/mipmap-hdpi/ic_launcher.png
magick logo.png -resize 96x96 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
magick logo.png -resize 144x144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
magick logo.png -resize 192x192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngcd android
./gradlew clean assembleDebugDebug APK location: android/app/build/outputs/apk/debug/app-debug.apk
cd android
./gradlew clean assembleReleaseRelease APK location: android/app/build/outputs/apk/release/app-release.apk
mkdir -p /Users/himanshukukreja/autoflow/NativeBridge/builds
cp android/app/build/outputs/apk/release/app-release.apk builds/nativebridge-v1.apkOr for debug:
cp android/app/build/outputs/apk/debug/app-debug.apk builds/nativebridge-debug-v1.apkadb install builds/nativebridge-v1.apkOr connect to LambdaTest device:
adb connect <device-id>
adb -s <device-id> install builds/nativebridge-v1.apkOn Launch:
- App shows biometric authentication screen
- Fingerprint/biometric sensor icon visible
- User must authenticate to proceed
If Biometrics Not Available:
- App shows error message
- Cannot access any features
- Must enable biometrics in device settings
After Successful Authentication:
- Shows "Authentication Successful!" message
- Unlocks the main app interface
- All features become accessible:
- Network Testing
- UI Testing
- Performance Testing
- Permission Testing
- File Operations
- QR Code Scanner
- Biometric Re-authentication
After authentication, test each section:
- Network: Make API calls, test connectivity
- UI Testing: Test button interactions
- Performance: Check metrics
- Permissions: Test permission requests
- Files: Upload and create CSV files
- QR Scanner: Scan QR codes
- Biometric: Test re-authentication
Error: Java version mismatch
# Check Java version
java -version
# Should be Java 17 for RN 0.74.7
# Set Java 17:
export JAVA_HOME=$(/usr/libexec/java_home -v 17)Error: Gradle build failed
# Clean and rebuild
cd android
./gradlew clean
./gradlew assembleDebug --stacktraceError: npm install fails
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm cache clean --force
npm install --legacy-peer-depsError: Biometric sensor not detected
- Ensure device has fingerprint sensor or face unlock
- Enable biometric authentication in device settings
- For emulators: Use AVD with fingerprint support enabled
Error: Camera not working
- Grant camera permission in app settings
- Check if camera permission is in AndroidManifest.xml
- Restart app after granting permission
Error: File operations fail
- Grant storage permission
- For Android 13+: Use scoped storage (already implemented)
- Check if WRITE_EXTERNAL_STORAGE permission granted
Error: App crashes on launch
# Check logcat for errors
adb logcat | grep -i "nativebridge\|error\|crash"Biometric prompt doesn't appear:
- Check if
USE_BIOMETRICpermission in manifest - Verify react-native-biometrics is properly linked
- Restart app and try again
Authentication fails repeatedly:
- Check device biometric settings
- Re-enroll fingerprint in device settings
- Try using device PIN as fallback (if
allowDeviceCredentials: true)
App stuck on authentication screen:
- Check console logs for errors
- Verify authentication state management in App.tsx
- Try force-closing and reopening app
- Initial release
- Based on NativeBridgeApp with all features
- Added mandatory biometric authentication gate
- React Native 0.74.7
- Package: com.nativebridge.io
For issues or questions:
- Check this documentation
- Review
BIOMETRIC_IMPLEMENTATION.mdfor technical details - Check logcat for error messages
- Review the original NativeBridgeApp implementation