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
Related
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 have some project as a library named LibProj. It has a lot of activities that I want to use in MainProj project but I'm getting Activity Not Found error.
I have done these steps.
one of them is shown below.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setComponent(new ComponentName("packagename//ex-com.hello",
"classname//ex-com.hello.ExampleActivity"));
startActivity(intent);
Second one is to add all activities' declarations in manifest of my MainProj project.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.doocat.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=".activity.main.IntroActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name=".activity.main.LoginActivity"
android:screenOrientation="portrait"
android:label="#string/app_name" />
<activity
etc...
Both of these ways not working. What I'm doing wrong or what is the solution?
Register Your Library Activity in MainProject manifest file..
I have given action name in intent-filter
com.lib.Example to identify which Activity need to call.
<activity
android:name="YOUR_LIBRARY_ACTIVITY_PACKAGE. ExampleActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.lib.Example" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Now call this Activity from your MainProject
Intent intent = new Intent("com.lib.Example");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
}
Hope This help you.
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" >
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' ?
I'm working on the Tabs example from Google Android Developers site (http://developer.android.com/resources/tutorials/views/hello-tabwidget.html) but I'm stuck in step 2.
At the very end of step 2 says "Duplicate this for each of the three activities, and add the corresponding tags to the Android Manifest file"
What exactly do I have to add to the AndroidManifest.xml?
Thanks
This is how your Manifest file should be:
<activity android:name=".ArtistsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".SongsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".AlbumsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
</application>
This will work for sure!!
just add every activity AndroidManifest.xml
main activity use:
<activity android:name=".Tabs">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
another activity use:
<activity android:name=".Tab1">
<intent-filter>
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Basically you have register each activities in AndroidManifest.xml like this
<activity android:name=".YourActivityName"/>
You have to add the corresponding <activity> tags for each one of the three activities. The AndroidManifest.xml file describes the components of the application (amongst other things like permissions and API level support).
In this example you have to add three definitions:
<activity android:name=".ArtistsActivity"/>
<activity android:name=".AlbumsActivity"/>
<activity android:name=".SongsActivity"/>