Error type 3. Activity class {com.awesome_project/ com.awesome_project.MainActivity} does not exist in react native (Android device)

后端 未结 24 1537
甜味超标
甜味超标 2021-01-30 20:10

I\'ve created the project using the following command.

react-native init Awesome_Project

I\'ve started the packager using the following com

24条回答
  •  孤城傲影
    2021-01-30 20:39

    This is happening if you have enabled build varaints in your app build.gradle file.

    When react-native runs, it seems to prefix test or something to your application id which changes the package names in some files but leaves others the same. Your application cannot find .MainActivity because it actually does not exist in the new package namespace that was generated.

    Here are some things to try to fix this issue:

    • Use FQDN in your Manifest file for the names of the application class and the activity class.
    • Replace your android cli file with this one. This is the file in /node_modules/react-native/local-cli/runAndroid

    This should solve your issue.

提交回复
热议问题