React-native run-android starting:intent Error Type 3 error:activity class does not exist

Source: Internet
Author: User

When you run an Android app using the react-native run-android command, you often see the following error:
Starting the app (/home/xxx/soft/sdk//platform-tools/adb Shell am start-n xxx/. mainactivity) ...
starting:intent {cmp=xxx/. Mainactivity}
Error Type 3
Error:activity class {xxx/xxx. Mainactivity} does not exist.
Although the app can be installed on your Android device, it doesn't affect use, but looks good for an eyesore. In the spirit of the principle can not avoid the problem, or to find ways to eliminate this error. After my attempts, finally solved the bug. Here's a record of the steps that were resolved.
1. The first is to check if the Mainactivity.java is true, and the package name and path are correct;
2. If the file exists and there is no problem with the package name and path, open the/android/app/build.gradle file where your project is located and delete the ApplicationID under Defaultconfig, as follows:
Apply plugin: ' Com.android.application '
Android {
compilesdkversion xxx
Buildtoolsversion "XXX"

defaultConfig {

ApplicationID "XXX"
or change the value of ApplicationID to the package specified in the manifest file.
Run "React-native run-android" again, OK.
This problem occurs because your package and ApplicationID are inconsistent. If you do not define ApplicationID in your Build.gradle file, this applicationid will default to the same value as the package specified in Androidmanifest.xml.
Note: Android Gradle for Android now has a package name that uniquely identifies the app as ApplicationID.

Quote Original: http://blog.csdn.net/zhaoyingm/article/details/52180352

Blog is to remember that they are easy to forget things, but also a summary of their work, the article can be reproduced, without copyright. Hope to do their own efforts to do better, we work together to improve!

If there is any problem, welcome to discuss together, code if there is a problem, you are welcome to the great God!

React-native run-android starting:intent Error Type 3 error:activity class does not exist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.