Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevSettingsActivity is not removed in release builds of Android #47223

Closed
SanjayDevTech opened this issue Oct 27, 2024 · 9 comments
Closed

DevSettingsActivity is not removed in release builds of Android #47223

SanjayDevTech opened this issue Oct 27, 2024 · 9 comments
Labels
API: Settings Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging Newer Patch Available Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@SanjayDevTech
Copy link

SanjayDevTech commented Oct 27, 2024

Description

I am using Expo managed workflow to build apps. But I do think this issue is not related to expo alone, so putting it here.

On Debug mode we can open the dev settings page by typing "m" in the console. I have seen DevSettingsActivity added to the AndroidManifest on debug app.

But when I build the release apk (by using github actions not eas cloud, but I think both doing the same), I still seeing the DevSettingsActivity added to AndroidManifest.

I saw there is a comment

<!-- This activity will be removed for release builds -->
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"
android:exported="false"
/>
mentioned like it will be removed in release.

Currently to remove I am using a config plugin

const { withAndroidManifest } = require("@expo/config-plugins")

module.exports = function androiManifestPlugin(config) {
  return withAndroidManifest(config, async config => {
    const androidManifest = config.modResults.manifest;

    const application = androidManifest["application"][0];

    application.activity = application.activity.map(
      activity => {
        if (activity.$["android:name"] !== "com.facebook.react.devsupport.DevSettingsActivity") return activity;
        activity.$["tools:node"] = "remove";
        return activity;
      }
    )

    return config
  })
}

Steps to reproduce

  1. Create any React Native App
  2. Build it in Release mode
  3. Analyse the APK using any APK analyser app found in playstore.

React Native Version

0.74.6

Output of npx react-native info

System:
  OS: Windows 11 10.0.22631
  CPU: "(8) x64 AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx  "
  Memory: 2.76 GB / 13.95 GB
Binaries:
  Node:
    version: 20.18.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.1
      - 34.0.0
      - 35.0.0
    Android NDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
IDEs:
  Android Studio: AI-242.21829.142.2421.12409432
  Visual Studio: Not Found
Languages:
  Java:
    version: 21.0.3
    path: C:\Program Files\Android\Android Studio\jbr\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Screenshots and Videos

No response

@SanjayDevTech SanjayDevTech added Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging Needs: Triage 🔍 labels Oct 27, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.74.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot react-native-bot added Newer Patch Available Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. API: Settings Platform: Android Android applications. labels Oct 27, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@SanjayDevTech
Copy link
Author

I found two PRs that does removes the DevSettingsActivity from main AndroidManifest.xml

But I don't know when it was changed again back.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Oct 27, 2024
@cortinico
Copy link
Contributor

But I don't know when it was changed again back.

The manifest that you linked is not used at all. It's only used by our internal build system, but is ignored by Gradle, so is not affecting React Native Open Source.

The source of thruth is here:

<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"

As you can see that manifest file is inside src/debug/... so it will be considered only for debug builds.

Where do you see that the DevSettingsActivity is added also for release builds?

cortinico added a commit to cortinico/react-native that referenced this issue Oct 29, 2024
Summary:
This file is used by BUCK only and should have not been exposed in the first place.
Fixes facebook#47223

Changelog:
[Internal] [Changed] - Move `com/facebook/react/devsupport/AndroidManifest` to Internal

Differential Revision: D65136247
cortinico added a commit to cortinico/react-native that referenced this issue Oct 29, 2024
…ebook#47279)

Summary:
Pull Request resolved: facebook#47279

This file is used by BUCK only and should have not been exposed in the first place.
Fixes facebook#47223

Changelog:
[Internal] [Changed] - Move `com/facebook/react/devsupport/AndroidManifest` to Internal

Differential Revision: D65136247
cortinico added a commit to cortinico/react-native that referenced this issue Oct 29, 2024
…ebook#47279)

Summary:
Pull Request resolved: facebook#47279

This file is used by BUCK only and should have not been exposed in the first place.
Fixes facebook#47223

Changelog:
[Internal] [Changed] - Move `com/facebook/react/devsupport/AndroidManifest` to Internal

Differential Revision: D65136247
cortinico added a commit to cortinico/react-native that referenced this issue Oct 29, 2024
…ebook#47279)

Summary:
Pull Request resolved: facebook#47279

This file is used by BUCK only and should have not been exposed in the first place.
Fixes facebook#47223

Changelog:
[Internal] [Changed] - Move `com/facebook/react/devsupport/AndroidManifest` to Internal

Differential Revision: D65136247
@SanjayDevTech
Copy link
Author

I have created a repo that reproduces this https://github.com/SanjayDevTech/demo-expo-app

if you run npx expo prebuild --clean, and check the android/app/src/main/AndroidManifest.xml, you can see the DevSettingsActivity added.

@SanjayDevTech
Copy link
Author

Just now saw the pr thanks

@cortinico
Copy link
Contributor

if you run npx expo prebuild --clean, and check the android/app/src/main/AndroidManifest.xml, you can see the DevSettingsActivity added.

Also that's a Expo related issue, you should probably open another issue on:

https://github.com/expo/expo/issues

@cortinico cortinico removed Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Attention Issues where the author has responded to feedback. labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Settings Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging Newer Patch Available Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants