Chad Bingham
Chad Bingham

Reputation: 33856

Error type 3: Activity Class {...} does not exist

AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.m.e"
      android:versionCode="5"
      android:versionName="3.0">

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
    <activity
            android:name="com.m.e"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action
                    android:name="android.intent.action.MAIN"
                    />

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
            android:name="com.m.e"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action
                    android:name="android.intent.action.first"
                   />

            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>

    .....

</application>

</manifest>

Error :

 Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.m.e/.Splash }
 Error type 3
 Error: Activity class {com.m.e/com.m.e.Splash} does not exist.

Note: .Splash does exist.

Upvotes: 34

Views: 73798

Answers (26)

Yuniac
Yuniac

Reputation: 573

For me, none of the solutions worked. Turned out my issue was that I had a guest profile on my Android phone, in that guest profile I had my app installed and forgot about it. On my main profile (which I use all the time) installing the app kept failing with exit code 3.

The solution was to switch to that other guest profile and uninstall the app from there. Or Settings > Apps > Your app > 3 dots menu > Uninstall for all users (If you have more than 1 guest profile, etc.)

Upvotes: 0

rgisi
rgisi

Reputation: 942

I had the same issue, I solved it by re-installing a previous production version on my Android phone (using the Play store), flutter run would run normally after that.

Upvotes: 0

zdd
zdd

Reputation: 8727

Sometimes this happens once you rename the project's root directory.

  1. Delete the .idea folder of your project.
  2. Reopen Android Studio and rebuild.

Upvotes: 2

Midou
Midou

Reputation: 57

You can simply change your applicationId in the build.gradle

Upvotes: 0

Yassin Ajdi
Yassin Ajdi

Reputation: 1550

This is how i fixed it. go to Gradle > Tasks > Install > UninstallAll

enter image description here

Upvotes: 27

ralphgabb
ralphgabb

Reputation: 10528

Yes I know there's already an accepted answer for this but its not working (or may no longer working). Currently at Android 8.0 Oreo version, there's is a chance that your app may be uninstalled on your device "But not for all user". So the next time you debug your App with your device this error happens.

Error: Activity class "class path here" does not exist
Error type 3

Heres how you fix it which absolutely works (searched for it for 2 days trust me)

  1. If you can still see your App under Settings > App > Select your app and go to option on its Toolbar and select "Uninstall For All User"

  2. If your app is not on the App list, generate/build an APK, in my case (Android Studio 3.0.1) you can go to Build > Build Apk. Install it manually on your device. Then do Step 1.

There ! Your app is all cleaned app and perfectly uninstalled. You can now debug it with development environment.

For further research : I believe Samsung Pass app has something to do with this error. Even after Uninstall. My project is still on their list.

Happy Codings Cheers !

Upvotes: 11

isabsent
isabsent

Reputation: 3763

I suppose you have a devices like my LG Stylus 3 Android 7.0, in which when you press and move app from desktop to the trash, app does not removed from device. See my accepted answer on the same question for details.

Upvotes: 1

WindRider
WindRider

Reputation: 12308

adb uninstall <your package name>

This is what worked for me. Though the app didn't even appeared as installed app but the uninstall command fixed the problem. My theory: Probably some data was left uncleared after a previous uninstall which is causing the next installation to be not fully complete.

Upvotes: 16

Gopalkrishna Mudaliar
Gopalkrishna Mudaliar

Reputation: 121

I got this error on Android O (Google Pixel C).I think i will get on other devices also.

I tried to install (from AndroidStudio) to any device it was fine, but not on Android O. On Android o I was getting same error (as given below).

The root cause. I have two users on that device (user1, user2). When I uninstall the app from user1 (the app is still there in user2). When I try to reinstall the app on user1 it returns the error.Same case in user2. To resolve the issue if I uninstall the app from both the users and re-install it works.

From command link if we use "adb install -r example.apk" it works, but AndroidStudio is not doing uninstall and reinstall (if you have two users in the device).

So in my case its was because of more than one user issue. All my other device (other than Android O) are single user, that is the reason, it was working on other devices, except on Pixel C (with two users). So watch out for multi user device.

No apk changes detected since last installation, skipping installation of /home/user/Project/AndroidStudioProjects/MyAddress/app/build/outputs/apk/app-debug.apk
$ adb shell am force-stop com.arris.myaddress
$ adb shell am start -n "com.example.address/com.example.address.MainActivity1" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.address/com.example.address.MainActivity1" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.address/.MainActivity1 }
Error type 3
Error: Activity class {com.example.address/com.example.address.MainActivity1} does not exist.

Error while Launching activity

Upvotes: 6

Adam Johns
Adam Johns

Reputation: 36353

I resolved this issue by restarting my test device and restarting Android Studio.

Upvotes: 0

Mohamed Dernoun
Mohamed Dernoun

Reputation: 825

Check if you are building hidden version. That’s intended behavior for hidden app.

If you want to build regular version, you need to change Build Variant in Android Studio Build > Select Build Variant, change it to regular.

Upvotes: 0

Parag Kadam
Parag Kadam

Reputation: 3850

In build.gradle,

change

apply plugin: 'android-library'

to

apply plugin: 'com.android.application'

If your build.gradle already has apply plugin: android-library then try to clean your project.

Upvotes: -2

mesutbeyaztas
mesutbeyaztas

Reputation: 101

I tried all of the suggestions above, but only that solved my problem;

  1. Change package name irrelevant one and sync gradle.
  2. Change package name to really you want, sync and run.

Upvotes: 5

Hanuman
Hanuman

Reputation: 968

I also faced same problem, problem is occurred when I am uninstalling the app and same time I given build.Then in the studio it is given the above error.so I tried every option, but those are not worked for me.So I checked in the settings -> apps --> selected my application and I seen the application is in disabled state, so it is not installing (giving error).I uninstalled the application and tried build then it works fine.

Upvotes: 5

Chad Bingham
Chad Bingham

Reputation: 33856

In build.gradle, the line:

 apply plugin: 'android-library'

needs changed to:

 apply plugin: 'com.android.application'

Upvotes: 29

Anil Chahal
Anil Chahal

Reputation: 2613

Go to your device settings. Select App option, select that particular app from the list, On top right corner, select Menu Bar option and select Remove for all users. It worked for me.

Upvotes: 6

Shawlaw
Shawlaw

Reputation: 568

Although it's a question posted years ago, I would like to share my solution.

Open Run->Edit Configuration, check if "Deploy default APK" is chosen in the package panel. "Deploy default APK" should be chosen.

The problem occurs to me because I choose "Do not deploy anything" earlier for some reason and I forget to undo the chosen.

Upvotes: 21

azhidkov
azhidkov

Reputation: 1077

In my case I tried all mentioned here and they didn't fix my problem. The problem was not in Android Studio but in device instead. And after I resetted my Android device to factory settings (as described here https://support.google.com/android-one/answer/6088915?hl=en) the problem disappeared.

Upvotes: 0

Ibrahim Al Ouayed
Ibrahim Al Ouayed

Reputation: 3

I had similar issue that I couldn't find a solution after searching and trying fixes from here and there. The only thing worked for me is creating a new project, copying all the codes in the old activities and pasting them to the new created activities (similar names but different package). It worked very good. I tried before changing the package name but it didn't work. It might work for you guys.

Upvotes: 0

john vuong
john vuong

Reputation: 255

When you manually changed the package name, if the manifest.xml is ok, then you need to change

apply plugin: 'android'

to

apply plugin: 'com.android.application'

Upvotes: 2

Cole Murray
Cole Murray

Reputation: 593

I recently just encountered this error. I fixed it by completely uninstalling the application on my device, and then re-running.

To offer some context, this was caused by using setComponentSetting()

Upvotes: 3

Blue5hift
Blue5hift

Reputation: 1014

I had the same error after renaming/refactoring. What I did was add the applicationId property attribute to my build.gradle file, and set its value to the application package. Like this:

android{
    defaultConfig{
        applicationId "com.example.mypackage"
    }
}

Upvotes: 25

Asqan
Asqan

Reputation: 4489

Renaming the activity was the fix in my case.

Upvotes: 0

Barrie Galitzky
Barrie Galitzky

Reputation: 1156

I was using a library module with an example Activity that was specified in the Manifest.

taking out the example activity from the manifest in the library project worked for me.

Upvotes: 0

MSaudi
MSaudi

Reputation: 4652

Mostly it's an eclipse issue, so the normal scenarios might work with you. Clean the project and rebuild the work space, open the manifest and check if there is any error, recheck the class name mentioned in the log, clean again and again, restart eclipse , open and clean.

Upvotes: 0

ianhanniballake
ianhanniballake

Reputation: 199825

Your error states that it is looking for com.codealchemist.clashmma.splash. Most Java classes start with an uppercase letter - make sure your class name matches exactly.

Upvotes: 1

Related Questions