-
Notifications
You must be signed in to change notification settings - Fork 25k
Closed as not planned
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.Type: Unsupported VersionIssues reported to a version of React Native that is no longer supportedIssues reported to a version of React Native that is no longer supported
Description
Description
Android Devices on Debug Builds it shows : Require , Global and Stack are not available
Steps to reproduce
Please connect with us we have following Index JS files
/**
* @format
*/
import 'react-native-gesture-handler';
import 'react-native-url-polyfill/auto';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
///Metro-config.js File
const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
const { resolver: { sourceExts, assetExts } } = defaultConfig;
const config = {
transformer: {
babelTransformerPath: require.resolve("react-native-svg-transformer"),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
assetExts: assetExts.filter((ext) => ext !== "svg").concat(['png', 'jpg', 'jpeg']),
sourceExts: [...sourceExts, "svg"],
resolverMainFields: ["sbmodern", "react-native", "browser", "main"],
},
};
module.exports = mergeConfig(defaultConfig, config);React Native Version
0.76.2
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
Environment
• React Native Version: 0.76.2
• React Version: 18.3.1
• Node Version: >=18
• Package Manager: npm
• Hermes: Tried both enabled and disabled
• Architecture: Tried both New and Old
• Metro Config: Default from 0.76.2 (with @react-native/metro-config)
• CLI: @react-native-community/cli 15.0.1
• OS: macOS 15.1.1
⸻
Issue Summary
When building the debug version of the Android app using npx react-native run-android, the latest changes in logic and UI are not reflected. The app appears to use a stale or outdated JS bundle. Additionally, Hot Reload and Fast Refresh do not work.
On iOS (Debug and Release), everything works correctly. This issue only occurs on Android in debug mode.
⸻
Steps Tried (All Failed)
1. Cleared caches and reinstalled dependencies:
rm -rf node_modules
rm -rf android/.gradle
rm -rf android/app/build
rm -rf android/build
rm -rf android/app/src/main/assets
npm cache clean --force
npm install
2. Reset Metro bundler cache:
npx react-native start --reset-cache
3. Manually generated the Android bundle:
mkdir -p android/app/src/main/assets
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
4. Toggled Hermes and Architecture:
• Enabled and disabled enableHermes: true/false
• Enabled and disabled newArchEnabled: true/false in gradle.properties
5. Copied Android folder from a new React Native project:
• This temporarily fixed Hot Reload and Fast Refresh.
• However, it caused a runtime error:
require is not defined
at anonymous global (index.android.bundle)
6. Attempted to patch require manually:
• Added a custom polyfill or fallback function for require in the entry point (index.js) to bypass the require is not defined error.
• This caused further issues or did not resolve the underlying problem, and may have interfered with Metro or bundler behavior.
7. Verified dev settings:
• Fast Refresh enabled from the Dev Menu.
• Confirmed app is in Dev Mode (_DEV_ === true).
• Debugging enabled in build.gradle:
debug {
debuggable true
}
⸻
Current Roadblocks
• Android debug builds continue to use old JS bundle and logic.
• Changes in JS files are not reflected after builds.
• Hot Reload / Fast Refresh don’t function as expected.
• Manual bundle generation leads to JS runtime error: require is not defined.
• Attempts to polyfill require in entry file didn’t resolve the issue.
• iOS builds (debug & release) work perfectly.
⸻
Expected Behavior
• Android debug build should reflect latest changes automatically.
• Hot Reload and Fast Refresh should work properly.
• Manual bundle generation should not break runtime execution.
• Android debug behavior should match iOS debug behavior.
⸻
Request for Help
Requesting support from:
• React Native Core Team
• Meta Engineers
• Community Experts
Need guidance on:
• Why Android debug builds are not syncing with latest JS code
• How to resolve stale bundle / caching problems
• Why require fails post bundling or Android folder replacement
• Recommended stable fix or workaround
Stacktrace or Logs
Can't Find Variable : require , stack : index.android.bundle:2.35
global code@index.android.bundle:2:2024
Reproducer
https://github.com/FDV-Team/FitWell-NishantTeam/tree/Ashraf_2025
Screenshots and Videos
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.Type: Unsupported VersionIssues reported to a version of React Native that is no longer supportedIssues reported to a version of React Native that is no longer supported

