[英]Error type 3. Activity class {com.project/ com.project.MainActivity} does not exist in react native (Visual studio EMulator for Android)
I am new to React-Native. 我是React-Native的新手。
I am trying to run my React-Native android project in Visual studio Emulator for Android. 我试图在Visual Studio Emulator for Android中运行我的React-Native android项目。
My build was successful by running react-native run-android
, but I am unable to launch the app in emulator. 通过运行react-native run-android
,我的构建成功完成,但是我无法在模拟器中启动该应用程序。
It is giving me the below error: 它给了我下面的错误:
Error type 3. Activity class does not exist. 错误类型3。活动类不存在。
I tried gradlew clean and gradlew cleanBuildCache. 我尝试了gradlew clean和gradlew cleanBuildCache。 but same error exists. 但存在相同的错误。
I checked the package name in below files and it is same in all 4 files.MainActivity.java, AndroidManifest.xml, build.gradle, MainApplication.java 我检查了以下文件中的包名称,所有4个文件中的包名称都相同.MainActivity.java,AndroidManifest.xml,build.gradle,MainApplication.java
Am I doing something wrong? 难道我做错了什么? Or how can I run my app in Visual studio Emulator? 或者如何在Visual Studio模拟器中运行我的应用程序?
have u opened your project in AndroidStudio? 您是否在AndroidStudio中打开了您的项目? After open in it, check for assets folder in App->src->main->assets , if not present make it. 在其中打开后,检查App-> src-> main-> assets中的assets文件夹(如果不存在)。
run following command 运行以下命令
$ react-native bundle –platform android –dev false –entry-file index.js –bundle-output android/app/src/main/assets/index.android.bundle –assets-dest android/app/src/main/res
then again try to build and run it. 然后再次尝试构建并运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.