searching unknown activity (java.lang.ClassNotFoundException)
-
04-07-2021 - |
سؤال
help me to resolve this getting this exception
java.lang.RuntimeException: Unable to instantiate application delhi.roshanara.margapp.MargApp: java.lang.ClassNotFoundException: delhi.roshanara.margapp.MargApp in loader dalvik.system.PathClassLoader[/data/app/delhi.roshanara.margapp-2.apk]
It is searching MargApp Activity to open the project but there is no activity of this name. And I want to start my activity as .LoginActivity. Manifest file structure is given below:-
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="MargApp" >
<activity
android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OrderMenuPage" />
<activity
android:name=".PartyOutstanding" />
<activity
android:name=".PartyPDC" />
<activity
android:name=".TakeOrder"></activity>
<activity
android:name=".ShowOutstanding"
android:screenOrientation="landscape" />
<activity
android:name=".ShowPDC"
android:screenOrientation="landscape"></activity>
</application>
المحلول
I would try removing
android:name="MargApp"
if that didn't work try Cleaning up your project
Project>Clean
نصائح أخرى
Do not use the android:name attribute! It, misleadingly, does not have anything to do with the name of your app and is actually the name of an extra class to load before loading your application. That's why you are getting the ClassNotFoundException
. Remove it and it should work:
Replace your application tag with this one...
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
لا تنتمي إلى StackOverflow