Heloo! I am creating an application in Android. I have declared all my activities in Android manifest, including the main one, and when i start it, it says that the activity i have selected as launcher does not exist:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.boacterapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="MainPage"
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="AboutPage"
android:label="title_firskljt_activity">
</activity>
<activity
android:name="RecentSightingsPage"
android:label="title_first_activity">
</activity>
</application>
</manifest>
I have been stuck here for a while, so i'm kindly asking that you could help me identity if i have a problem in my manifest. Thank you in advance!
Make sure MainPage activity is in package "com.example.boacterapp".
Another option: replace short name:
android:theme="#style/AppTheme" >
<activity
android:name="MainPage" <----------------- short
android:label="#string/app_name" >
<intent-filter>
With long name that makes up the full class name of your activity:
android:theme="#style/AppTheme" >
<activity
android:name="com.bla.bla.MainPage" <------------- long
android:label="#string/app_name" >
<intent-filter>
Add "." (dot) before MainPage
as
android:name=".MainPage"
Same for others,so rewrite your manifest as
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.boacterapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainPage"
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=".AboutPage"
android:label="title_firskljt_activity">
</activity>
<activity
android:name=".RecentSightingsPage"
android:label="title_first_activity">
</activity>
</application>
</manifest>
<activity android:name="MainPage"
should be:
<activity android:name=".MainPage"
assuming that your MainPage activity is in the package com.example.boacterapp. If not, you need to provide the fully-qualified name of the MainPage app.
Activity name should have dot prefix, change activity name to .MainPage. Make sure it is inside com.example.boacterapp package
Related
How do I add:
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main">
</activity>
into the AndroidManifest.xml
which currently looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bac"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
</manifest>
I'm fairly new to android programming and have yet to figure out a lot of stuff about transferring between pages and other things like that. Thanks for any help you give!
Just Add another Activity tag under your application tag
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bac"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main">
</activity>
</application>
</manifest>
If you are new to android and trying to understand about manifest
Have a look at ANDROID-DEVELOPERS-SITE ..... Click here
Have a look at youtube-tutorial too hope this helps
It has all the information you need to get started knowing more about the manifest file
You need to add your Activity inside Application tag.
The activity is the child node of the application node. The multiple activities can specify by multiple nodes of activity.
Read this : manifest-intro
your manifest will be look like
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bac"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
<!-- Add your activities here -->
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main">
</activity>
</application>
</manifest>
you can add any number of activity inside your application tag in AndroidManifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bac"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
<!-- activity goes here-->
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main">
</activity>
</application>
</manifest>
to add an activity to the Manifest , just copy the content of the exesting activity in the manifest and remove the intent filter like this
---the original
<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>
---the new
<activity
android:name=".yourNewActivityName"
android:label="#string/app_name" >
</activity>
you need add this in the application tag.
you need to change the android:name property to your new activity's name
This is what my AndroinManifest.xml looks like
<manifest package="com.dz122596.bubblebop"
android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:icon="#drawable/ic_launcher" <!-- THIS ICON(IMAGE) WILL BE SHOWN IN YOUR APPS -->
android:label="#string/app_name" <!-- HERE LABEL(APP NAME) -->
<activity
android:name=".startingpoint" <!-- (.)dot means current dir, if your activity is in another package then give cull package name ex: com.xxx.Activity -->
android:label="#string/app_name"
android:screenOrientation="portrait"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</manifest>
And startingpoint.java the activity Iam trying to launch is in the same package but when I run it says no launcher activity found.
Your manifest file's code says that your forgot to end the Application tag. You need to write </application> before </manifest> tag. Just add it and your problem will be solved.
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.dz122596.bubblebop"
android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".startingpoint"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> <!-- Add this closing tag -->
</manifest>
just make few changes to ur manifest file. follow below manifewst file.
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />
<application android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity android:name="com.dz122596.bubblebop.startingpoint"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I read this:
Error in AndroidManifest.xml "must have a minimum of 2 segments" but there is no solution.
Its happen after I change the name of the project by refactor->rename (instead com.example.my app to myapp only) and after that I change the name also in the manifest.
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="save_money"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="save_money.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="save_money.Article"
android:label="#string/title_activity_article" >
</activity>
<activity
android:name="save_money.HashmalActivity"
android:label="#string/title_activity_hashmal" >
</activity>
<activity
android:name="save_money.ImageAdapter"
android:label="a" >
</activity>
<activity
android:name="save_money.SavedItems"
android:label="פריטים שמורים" >
</activity>
<activity
android:name="save_money.Screen2HashmalActivity"
android:label="עלות צריכה" >
</activity>
<activity
android:name="save_money.SelectArticle"
android:label="בחר מאמר" >
</activity>
</application>
</manifest>
What it means is the package declaration in your manifest must have at least two portions separated by a period (.). Instead of just saying package="save_money", change it to package="com.save_money". That should remove your error. Likewise, everywhere you specify the name of an activity, you also need to update it there. Best of luck!
My guess is you need to have a minimum of 2 segments for your package name.
So instead of package="save_money Try package="me.save_money" or whatever you want.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bpi.mygears"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.bpi.gears.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="com.bpi.gears.home"
android:label="#string/title_activity_home" >
</activity>
<activity
android:name="com.bpi.gears.profile"
android:label="#string/title_activity_profile" >
</activity>
</application>
</manifest>
this is my manifest feel free to check it and tell me where im wrong i would help a lot if you need to see all i can show you all my project has no error so im having a difficult time finding where im wrong...
I think you have some problems with your naming. Your package name is "com.bpi.mygears" and you are looking for activities that are com.bpi.gears. Your activities can just be named relative to the package. It should probably be more like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bpi.mygears"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
<activity
android:name=".home"
android:label="#string/title_activity_home" >
</activity>
<activity
android:name=".profile"
android:label="#string/title_activity_profile" >
</activity>
</application>
</manifest>
Assuming your stuff is in com.bpi.mygears. Otherwise, make that first line
package="com.bpi.gears" if your stuff is in gears.
I switched in manifest manually between activities because I made new activity that needed to be first. Everything works fine, but in the apps screen in my launcher where I see all apps below my app icon i see the name of the first activity "SplashScreen", but when I uninstall in or go to my apps I see that the name is OK.
My manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name="com.myapp.SplashScreen"
android:label="#string/title_activity_splash_screen"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.MainScreen"
android:label="#string/title_activity_main_screen"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.myapp.Cameras"
android:label="#string/title_activity_cameras"
android:screenOrientation="portrait" >
</activity>
</application>
android:label="#string/title_activity_splash_screen"
that is the name being used.
you can just delete this line (and all the label from the other activities) and let all activities use the application name #string/app_name
<activity
android:name="com.myapp.SplashScreen"
android:label="#string/app_name"
android:screenOrientation="portrait" >
This should display the Application name