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' ?
Related
I am launching my android app from android studio, the app is working fine but unable to launch it from the launcher as it is not showing up there. Looking at other posts it seems that this issue could be because of incorrect AndroidManifest.xml, but mine seems to fine based on other answers.
Below is AndroidManifest.xml from my project.
Full file is here -> https://pastebin.com/E7KMxQZD
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Here is my manifest file
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.android.developers.service.MainActivity"
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=".MyService" >
</activity>
<service
android:name=“MyService"
android:enabled="true”>
</service>
</application>
It gives me the following error:Open quote is expected for attribute "{1}" associated with an element type "android:name".
Take a look at where the syntax highlighting screws up on this site, and you'll see it
The marks here are not (XML) quotation marks:
android:name=“MyService"
¯
android:enabled="true”>
¯
in the service the android name should be like this
<service
android:name=".NameOfService">
</service>
It is better to write ful package name and then name of service.
<service
android:name="packaganame.NameOfService">
</service>
The error is because of the first open quote which is right after android:name=. switch input method to English and replace the open quote of "MyService" :)
Please look at your manifest file, here you have written two times MyService. The modified code is:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.android.developers.service.MainActivity"
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=".MyService" >-->
</activity>
<service
android:name=".MyService"
android:enabled="true"
android:exported="true" >
</service>
</application>
This should fix any problems you're having.
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 have problems running the latest Android emulators like "Nexus 7, Android 4.1.2". The emulator can start, but I can't deploy on it (by Maven) which probably depends on this problem: When I switch on the phone to the Apps view, I get "Unfortunately, launcher has stopped" and LogCat gives me the following output:
01-02 14:30:26.313: W/ActivityManager(151): Permission denied:
checkComponentPermission() owningUid=1000 01-02 14:30:26.313:
W/BroadcastQueue(151): Permission Denial: broadcasting Intent {
act=android.appwidget.action.APPWIDGET_UPDATE_OPTIONS flg=0x10
cmp=com.android.settings/.widget.SettingsAppWidgetProvider (has
extras) } from android (pid=970, uid=10014) is not exported from uid
1000 due to receiver
com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider
My AndroidManifest looks like this:
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="7" />
<application
android:name="my.domain.appcontext.ApplicationContext"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:allowBackup="true">
<activity
android:name="my.domain.appcontext.activities.MainActivity"
android:screenOrientation="nosensor"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="my.domain.appcontext.activities.MainMenuDialogActivity"
android:excludeFromRecents="true"
android:theme="#style/Theme.Dialog" >
</activity>
<activity
android:name="my.domain.appcontext.activities.DistrictMenuDialogActivity"
android:excludeFromRecents="true"
android:theme="#style/Theme.Dialog" >
</activity>
<activity
android:name="my.domain.appcontext.activities.StreetMenuPreselectionDialogActivity"
android:excludeFromRecents="true"
android:theme="#style/Theme.Dialog" >
</activity>
<activity
android:name="my.domain.appcontext.activities.StreetMenuDialogActivity"
android:excludeFromRecents="true"
android:theme="#style/Theme.Dialog" >
</activity>
<uses-library android:name="com.google.android.maps"
android:required="true" />
</application>
Any ideas?
Are you trying to send the android.appwidget.action.APPWIDGET_UPDATE broadcast somewhere in your code? This is an Android OS broadcast, so you won't have permission to use it if you are...
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" >