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" >
Related
I'm a beginner in Android.
Every time when I open class teacher's project to my system it shows this error.
Error running app: Default activity not found.
What should I do to match the same project as my teacher's?
I've tried many solutions.
My Manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.assigncheckbox">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
maybe it happen because you didn't add this activity to your AndroidManifest.xml
<activity
android:name=".yourActivity"
/>
I'm working on an Android app and have just added the Splash Screen as I will be loading from SQLite on start-up...
After telling the AndroidManifest that I'd like to have my Splash activity as my LAUNCHER, it seems that it's changed the name that my app is downloaded under.
The app is now called Splash, has anyone had this problem before?
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.codedaykcrunningapp.MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.example.codedaykcrunningapp.Workout"
android:label="#string/title_activity_workout" >
</activity>
<receiver
android:name="com.example.codedaykcrunningapp.Widget"
android:label="#string/app_name" >
</receiver>
<activity
android:name="com.example.codedaykcrunningapp.Splash"
android:label="#string/title_activity_splash"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Android is using the label name of your launcher activity so change that to your app name
change
<activity
android:name="com.example.codedaykcrunningapp.Splash"
android:label="#string/title_activity_splash"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
....
to
<activity
android:name="com.example.codedaykcrunningapp.Splash"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
....
this will fix your problem
After telling the AndroidManifest that I'd like to have my Splash
activity as my LAUNCHER, it seems that it's changed the name that my
app is downloaded under.
BCOZ
If you have a "launcher activity" with [label name] & "application tag" also with a different [label name] then Android will take the [label name] from the Launcher Activity.
For more information you can see this android documentation.
The app name is set in the file Android Manifest, please check the item application and attribute android:label.
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
...
</application>
I am trying to add a second activity to my android manifest file but am receiving a INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error. I have isolated the offending code to this line:
<activity android:name="com.MyPackage.Main.FacebookLoginActivity"
android:label="Facebook"></activity>
When I type it in like this
<activity android:name=".FacebookLoginActivity"
android:label="Facebook"></activity>
it works fine but when I try to start the activity via
this.startActivity(new Intent(this, FacebookLoginActivity.class));
I get an error saying cannot locate "com.MyPackage.Main/com.MyPackage.Main.FacebookLoginActivity".
Is that activity wrong in some way?
Here a portion of my manifest file:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:allowBackup="true">
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="#string/app_name"
android:theme="#style/Theme.NoBackground">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.MyPackage.Main.FacebookLoginActivity" android:label="Facebook"></activity>
<activity android:name="com.facebook.LoginActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
</application>
Try changing you package declaration to com.mypackage.main.
Your class name would be com.mypackage.main.FacebookLoginActivity
I get this error:
06-06 10:45:19.685: E/AndroidRuntime(554): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.Android.myApp/com.Android.myApp.Facebook.Example}; have you declared this activity in your AndroidManifest.xml?
But i have declared it in my manifest file. what might be the other reasons for such exception?
My manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Android.myApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light" >
<activity
android:name=".SignUpActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SignInActivity"
android:label="#string/app_name" />
<activity
android:name=".HomeActivity"
android:label="#string/app_name" />
<activity
android:name=".selectCityActivity"
android:label="#string/app_name" />
<activity
android:name=".FeedListViewActivity"
android:label="#string/app_name" />
<activity
android:name=".SearchActivity"
android:label="#string/app_name" />
<activity
android:name=".IWantActivity"
android:label="#string/app_name" />
<activity
android:name=".DateActivity"
android:label="#string/app_name" />
<activity
android:name=".ShareActivity"
android:label="#string/app_name" />
<activity
android:name=".ShareProductActivity"
android:label="#string/app_name" />
<activity
android:name=".SharePriceActivity"
android:label="#string/app_name" />
<activity
android:name=".ShareStoreActivity"
android:label="#string/app_name" />
<activity
android:name=".ProfileActivity"
android:label="#string/app_name" />
<activity
android:name=".ShowMapActivity"
android:label="#string/app_name" />
<activity
android:name=".ParticularEntryActivity"
android:label="#string/app_name" />
<activity
android:name=".MyLocationActivity"
android:label="#string/app_name" />
<activity
android:name=".MapMarkerActivity"
android:label="#string/app_name" />
<activity
android:name=".BarcodeActivity"
android:label="#string/app_name" />
<activity
android:name=".BarcodeResult"
android:label="#string/app_name" />
<activity
android:name=".FeedbackActivity"
android:label="#string/app_name" />
<activity
android:name=".SplashActivity"
android:label="#string/app_name" />
<activity
android:name=".Example"
android:label="#string/app_name" />
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
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>
you can also use
<activity
android:name=".Facebook.Example"
android:label="#string/app_name" />
I got a variation to this problem. I was launching an activity called "Settings" and getting the same error and making all the suggested changes to the manifest were not fixing the problem.
Thing is, in the calling activity, I was also using / importing android.provider.Settings, so from what I can see when trying to launch the activity it was getting confused between the two. Thus I changed this in the code rather than the manifest to include the full path:
Intent launchScr = new Intent(this, com.foo.bar.Settings.class);
And it worked. Of course, the other, and better, way to solve this particular issue would be to use better names for my activities.
HTH anyone with this variant of the problem.
Sometimes,It's due to existence of the same class name (second parameter of the Intent) in different packages.
I found also that this occurs when you call startService instead of calling startActivity and vice versa.
From your exception which one is your class - Facebook or Example Because, you declared in package in manifest as com.Android.myApp But, for facebook activity you declared com.android.myApp.Facebook.Example And,
If example is your activity means, you should declared your activity as com.Android.myApp.Facebook.Example Because, its from different package or your Activity name as Facebook.Example So better you can declare your Activity like below -
<activity
android:name="com.Android.myApp.Facebook.Example"
android:label="#string/app_name" />
This can happen on large projects when the cached manifest gets out of sync. I was able to fix it in the Android Studio terminal with ./gradlew clean and then in the Android Studio menu bar selecting File > Invalidate Caches / Restart for good measure
Just make sure your Activity is decorated with this attribute:
[Activity(Label = "Your App Name", MainLauncher=true)]
Note: Only Set MainLauncher if needed.
This works if you have an Activity object (which you need to launch):
intent.setClassName(CallingActivity.this, activityToLaunch.getComponentName().getClassName());
You need to use this code if you wish to change your class dynamically from string:
Intent intent = new Intent().setClassName(this.getPackageName(), "com.some.other.name");
or you can put result from array or any other instead of "com.some.other.name". Cheers!
I've built an app that runs fine on the emulators, and says that it installs ok on the phone. However, on trying to run it an error pops up saying 'Application is not installed on your phone'. So I tried running the app through eclipse on the phone and I got this error in the console:
[2012-05-01 12:00:02 - MAD Assignment] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mad.assignment/.MainMenu }
[2012-05-01 12:00:02 - MAD Assignment] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.mad.assignment/.MainMenu } from null (pid=8204, uid=2000) requires null
From looking for the solution elsewhere it sounds as though it could be a problem in the manifest file, so here is mine:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mad.assignment"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity
android:name="MainMenu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Diary"></activity>
<activity android:name=".Info"></activity>
<activity android:name=".MapMenu"></activity>
<activity android:name=".RSSMenu"></activity>
<activity android:name=".RSSFeedView"></activity>
<activity android:name=".MainMenu"></activity>
<activity android:name=".RSSDetailed"></activity>
<activity android:name=".DiarySchedule"></activity>
<activity android:name=".DiaryAddEntry"></activity>
<activity android:name=".DiaryEditEntry"></activity>
<activity android:name=".DiaryDetailed"></activity>
<activity android:name=".RSSDetailed"></activity>
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".MapMain"></activity>
<activity android:name=".RSSFeedView"></activity>
<activity android:name=".MapWhatsNearPreferences"></activity>
<activity android:name=".RoutePath"></activity>
</application>
Any ideas what this security exception is pointing to? Thanks!
The java.lang.SecurityException you are seeing is because you may enter two entries pointing to same activity. Remove the second one and you should be good to go.
You may be declared the activity 2 times in the manifest with different properties, like :
<activity android:name=".MainMenu"> </activity>
and
<activity android:name=".MainMenu" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You should remove the unwanted one from the manifest
Set android:debuggable="true" under application.
You have an activity named
<activity android:name=".MainMenu"></activity>
Which is the Intent'ed activity from the launcher. But the activity to which you gave permission is "Mainmenu". Remove it. Add the permission and etc to the ".Mainmenu" which is blank now.
ie,
The 'activity' group should be
<activity
android:name=".MainMenu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Diary"></activity>
<activity android:name=".Info"></activity>
<activity android:name=".MapMenu"></activity>
<activity android:name=".RSSMenu"></activity>
<activity android:name=".DiarySchedule"></activity>
<activity android:name=".DiaryAddEntry"></activity>
<activity android:name=".DiaryEditEntry"></activity>
<activity android:name=".DiaryDetailed"></activity>
<activity android:name=".RSSDetailed"></activity>
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".MapMain"></activity>
<activity android:name=".RSSFeedView"></activity>
<activity android:name=".MapWhatsNearPreferences"></activity>
<activity android:name=".RoutePath"></activity>
And remove the duplicates as well. Why did you add so many duplicate 'activities' ?