'Error type 3Error: Activity class {} does not exist.` error when trying to launch Android app in React Native

Asked 2 years ago, Updated 2 years ago, 89 views

I'm a beginner at React Native.

yarn run android causes the following error and the application does not start with the emulator

Please let me know the possible causes.

$yarn run android
yarn run v1.9.4
$ ENVFILE=.env.dev node node_modules/react-native/local-cli/cli.js run-android
Scanning folders for symlinks in/Users/username/dev/react-native/asdo-app/node_modules (11ms)
JS server already running.
Building and installing the app on the device (cd android & ./gradlew installDebug) ...

Configure project:app
WARNING: The option 'android.enableAapt 2' is deprecated and should not be used anymore.
Use'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018..
Reading env from:.env.dev
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion'27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Configure project:react-native-config
WARNING: The option 'android.enableAapt 2' is deprecated and should not be used anymore.
Use'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion'27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Configure project: react-native-device-info
WARNING: The option 'android.enableAapt 2' is deprecated and should not be used anymore.
Use'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion'27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Configure project: react-native-vector-icons
WARNING: The option 'android.enableAapt 2' is deprecated and should not be used anymore.
Use'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion'27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Task:app:installDebug
Installing APK'app-debug.apk'on'Nexus_5X_API_24(AVD) - 7.0' for app: debug
Installed on 1 device.


BUILD SUCCESSFUL in 3s
84 actionable tasks:1 executed, 83 up-to-date
Running/Users/username/Library/Android/sdk/platform-tools/adb-semulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/Users/username/Library/Android/sdk/platform-tools/adb-semulator-5554 shell am start-n com.test_app/com.test_app.MainActivity) ...
Starting:Intent {cmp=com.test_app/.MainActivity}
Error type 3
Error: Activity class {com.test_app/com.test_app.MainActivity} does not exist.
✨ Done in 5.41s.

react-native

2022-09-30 16:22

1 Answers

Try to see if you can you solve this problem?
1.Remove android.enableAapt2=false in gradle.properties
2. Replace compile in build.gradle with implementation
3. Run Update Build Tools version and sync project


2022-09-30 16:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.