Skip to content

DevSettingsActivity is not removed in release builds of Android #47223

Closed
@SanjayDevTech

Description

@SanjayDevTech

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions