I set a file .env.devdps
APP_NAME=TestDps
just use APP_NAME
in AndroidManifest.xml
<activity
...
android:label="@string/APP_NAME"
/>
In my android/app/build.gradle
defaultConfig {
...
resValue "string", "build_config_package", "com.testdev"
manifestPlaceholders = [label: 'testDev']
}
and I add a buildTypes dps
buildTypes {
debug {
signingConfig signingConfigs.debug
applicationIdSuffix ".dev"
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
dps {
initWith debug
applicationIdSuffix ".dps"
matchingFallbacks = ['debug']
}
}
Then type command in terminal:
ENVFILE=.env.devdps npx react-native run-android --variant=dps
The result shows error Activity class {com.testdev/com.testdev.MainActivity} does not exist
BUILD SUCCESSFUL in 11s 46 actionable tasks: 46 executed info Connecting to the development server... info Starting the app on "emulator-5554"... Starting: Intent { cmp=com.testdev/.MainActivity } Error type 3 Error: Activity class {com.testdev/com.testdev.MainActivity} does not exist.
How to fix the issue ?
Check if you MainActivity.java and MainApplication.java files are under the correct path. For example, if your bundle id is: com.companyname.app they should be under android/app/src/main/java/com/companyname/app. Also check you have the correct package in your AndroidManifest.xml that should be the same of your bundle id (in this example: com.companyname.app). Same for package in MainActivity and Mainapplication files.