Android.Content.Activitynotfoundexception: Unable to Find Explicit Activity Class

android.content.ActivityNotFoundException: Unable to find explicit activity class

You declared package name in the manifest as com.Android.myApp and Activity Name .Example.So android will search it from com.Android.myApp.Example.
But your activity is residing in "com.Android.myApp/com.Android.myApp.Facebook.Example".So give the activity name as .Facebook.Example or full path as given below
In the manifest

<activity
android:name="com.Android.myApp.Facebook.Example">

</activity>

android.content.ActivityNotFoundException: Unable to find explicit activity class - how to fix it?

You're instantiating the intent before the activity has gone through its life cycle methods. This means that the Context that you pass in to the Intent constructor is not valid.

Typically, the intent is created right before you use it:

newEvent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainMenu.this, EventCreationActivity.class);
startActivity(intent);
}
});

Unable to find explicit activity class. Have you declared this activity in your AndroidManifest.xml

declare your activity like this:

<activity
android:name=".AppPreferenceActivity"
android:label="Preferences" >
<intent-filter>
<action android:name="com.iphonik.chameleon.AppPreferenceActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

and use it:

Intent i = new Intent("com.iphonik.chameleon.AppPreferenceActivity");

android.content.ActivityNotFoundException: Unable to find explicit activity class Android Studio Kotlin Error

Replace:

R.layout.registration::class.java

with:

Registration::class.java

You are attempting to use a resource ID as an Activity class, and that will not work.

Kotlin unable to find explicit Activity class

What's Happening?

The activity lowerLegsActivity name seems incorrect in the manifest. Your application package name as per manifest is fr.amseu.mystretching, but the package in which your class LowerLegsActivity lies is different as per error logs i.e. fr.amseu.myapp.Activity

Solution 1 (Quick Fix)

Replace this

android:name=".lowerLegsActivity"

With

android:name="fr.amseu.myapp.Activity.LowerLegsActivity"

Solution 2 (Recommended)

Move class LowerLegsActivity to package fr.amseu.mystretching.Activity and perform the following replacement in the manifest

Replace this

android:name=".lowerLegsActivity"

With

android:name=".Activity.LowerLegsActivity"

Similar Issue: https://stackoverflow.com/a/10908567/1890849

Android Studio: Unable to find explicit activity class but activity already declared in AndroidManifest.xml

Please follow these steps.

1.You should rename ImageView class to something else like ImageViewActivity or any thing.

2.Make sure this activity extends Activity or AppCompatActivity.

3.Make sure this activity is under directory app\src\main.

This should resolve your problem.

ActivityNotFoundException: Unable to find explicit activity class

I created a clean copy of MainActivity, duplicated the xml and replaced all references to the old activity and it works. The declaration in the manifest is also identical.

I have no idea why this problem occurred, but a deep inspection definitely doesn't worth it, so this workaround is the least time consuming solution.

EDIT: I faced this issue again and found the real problem. There was a piece of code that disables the aforementioned activity, which then throws ActivityNotFoundException even when the app is closed and re-opened. I guess that clearing cache would have revealed the situation as well.

Anyway, I added a temporary code in the calling activity to enable MainActivity and it worked:

PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(this, MainActivity.class),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);

I obviously removed the disabling code, which is not relevant.

Android Error: Unable to find explicit activity class

Your problem is that the class is not included in the manifest file.

If you look, you'll notice that following code is in your manifest:

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

You will have to do pretty much the same for your showdata.java class.

Solution. Add this to your Android Manifest file:

<activity android:name=".showdata"/>


Related Topics



Leave a reply



Submit