So I'm getting the MainActivity does not exist error, it might be because I renamed the package and app from bomber
to Bomber
and changed the appId from com.bomber
to cool.bomber.android
I've checked the AndroidManifest, the activity source files and the build.gradle file but I can't seem to find what's the mistake
Error message
Starting: Intent { cmp=cool.bomber.android/.MainActivity }
Error type 3
Error: Activity class {cool.bomber.android/cool.bomber.android.MainActivity} does not exist.
app/build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "cool.bomber.android"
...
AndroidMaifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.google.intent.category.CARDBOARD" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="foo.app.goo.gl" android:scheme="http"/>
<data android:host="foo.app.goo.gl" android:scheme="https"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
android/app/src/main/java/cool/bomber/android/MainActivity.java
package cool.bomber.android;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
return "Bomber";
}
}
I'm not sure what else I should be looking at to debug.
You need to uninstall the application properly.
If it does not work from the phone, you can use cmd
adb uninstall "package name"
Add package name in manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cool.bomber.android">
and still not working than write full package name like this
<application
android:name="cool.bomber.android.MainApplication"
android:allowBackup="true" >
<activity
android:name="cool.bomber.android.MainActivity"
>
and make sure this is the right path
and in CMD write this:
cd android & gradlew clean
or maybe
cd android && ./gradlew clean
and than run react-native run-android
Make sure when you write this code you are at root of your project folder
Or Else:
Follow this to refresh whole project after changing package using android studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With