No launcher activity found in eclipse java android [duplicate] - java

This question already has answers here:
What does it mean "No Launcher activity found!"
(17 answers)
Closed 8 years ago.
I'm getting something that looks like this:
"No Launcher activity found!
The launch will only sync the application package on the device!"
I'm not sure how to fix this. My AndroidManifest looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloworld"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="20" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
</application>
</manifest>
Any help would be greatly appreciated. Thanks!

You need to add the activity to your manifest. For example, if your initial activity is called MainActivity:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.helloworld.MainActivity"
android:label="Main Activity!" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Edit: The above shows an activity that is also being used as a launcher. Here is an example of a regular activity also being added to the manifest.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.helloworld.MainActivity"
android:label="Main Activity!" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.helloworld.SecondActivity"
android:label="My second activity"
android:parentActivityName="com.example.helloworld.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.helloworld.MainActivity" />
</activity>
</application>

You should add your acivities to the manifest file.
For Example:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="<Package><ClassName>"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</applicaion>

Whenever you create Android Project in Eclipse it automatically generates a class called MainActivity which extends activity and generates Manifest file for you with a default entry of your MainActivity. Whenever you create a new class that extends Activity then you have to manually enter your activity in your manifest. You can change your your intent filter any time and you can set it to any activity and that activity will be your launcher activity of the app. This is a default Manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
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.example.test.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>

Related

Android Studio: Unable to find explicit activity class have you declared this activity in your AndroidManifest.xml

my code manifest is: I am getting an run time exception "Unable to find explicit class" have you declared this activity in your AndroidManifest.xml?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.awesomeapps.yash.messagescheduler"
android:installLocation="auto">
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SetuppageActivity"
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=".CancelAnAlarmActivity"
android:label="Cancel Alarm">
</activity>
<service android:name="com.awesomeapps.yash.messagescheduler.SendSMSAlarmService"/>
</application>
</manifest>

Android: No Launcher activity found! Did check LAUNCHER

So most responses told me to check that there's an activity with the category set to LAUNCHER. I have 2 activities - one starting the other, and 2 .xml layout files (for each of the activities)- I get the "No Launcher activity found" when trying to run on emulator.
This is my manifest-file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dk.orbliners.workout"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
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="dk.orbliners.workout.MainActivity" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="SecondaryActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="dk.orbliners.workout.SecondaryActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
For your main activity you need something like this:
<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>

Android virtual KeyBord and Edit Text

I have a problem with my virtual keyboard, it hides the text boxes in which I want to write
my xml manifest, I added code to try but nothing works (Still the keyboard hides text boxes ):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="
http://schemas.android.com/apk/res/android"
package="com.example.Pointage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustPan"
>
<activity
android:name="com.example.test.MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.test.Activity2"
android:label="#string/title_activity_activity2"
>
</activity>
<activity
android:name="com.example.test.Bdd"
android:label="#string/title_activity_bdd" >
</activity>
</application>
</manifest>
try this:
android:windowSoftInputMode="stateVisible|adjustPan"
or
android:windowSoftInputMode="stateVisible|adjustResize">
Reference link
This should work
android:windowSoftInputMode="adjustPan"

ERROR ! in Android - java developer - The markup in the document following the root element must be well-formed

Am getting following error in AndroidManifest.xml
The markup in the document following the root element must be well-formed.
And my xml is :
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< Original
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ctic.android.screenswapper"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".BasicScreenActivity"
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=".StartCameraActivity"
android:label="#string/title_activity_othar_screen" >
</activity>
<activity
android:name=".GpsActivity"
android:label="#string/title_activity_gps" >
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
<activity
android:name=".HelpActivity"
android:label="#string/title_activity_help" >
</activity>
<activity
android:name=".AboutAppActivity"
android:label="#string/title_activity_about_app" >
</activity>
<activity
android:name=".HowToUseActivity"
android:label="#string/title_activity_how_to_use" >
</activity>
<activity
android:name=".AlertActivity"
android:label="#string/title_activity_alert" >
</activity>
</application>
</manifest>=======
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity
android:name="ctic.android.screenswapper.StartCameraActivity"
android:label="#string/title_activity_start_camera" >
</activity>
</application>
</manifest>>>>>>>> Added
Remove the below from the manifest file
<<<<<<< Original
</manifest>=======
</manifest>>>>>>>> Added
I think this happens with eclipse ide sometimes.
Also there is no need for two manifest tag in your manifest file. Remove the duplicate. Have the below. You already have the StartCameraActivity declared.
Make sure the package names in the activity and the manifest are correct
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ctic.android.screenswapper"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".BasicScreenActivity"
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=".StartCameraActivity"
android:label="#string/title_activity_othar_screen" >
</activity>
<activity
android:name=".GpsActivity"
android:label="#string/title_activity_gps" >
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
<activity
android:name=".HelpActivity"
android:label="#string/title_activity_help" >
</activity>
<activity
android:name=".AboutAppActivity"
android:label="#string/title_activity_about_app" >
</activity>
<activity
android:name=".HowToUseActivity"
android:label="#string/title_activity_how_to_use" >
</activity>
<activity
android:name=".AlertActivity"
android:label="#string/title_activity_alert" >
</activity>
</application>
</manifest>
The XML in your question includes these lines:
<<<<<<< Original
</manifest>=======
and
</manifest>>>>>>>> Added
The first and third would make the XML syntactically invalid; i.e. not well-formed. The second line is also probably a mistake.
It looks to me like someone has made a mistake when resolving conflict between two branches when using source code version control.
Looks like a merge conflict produced by your Version Control. Remove one of them should fix your problem
<<<<<<< Original
</manifest>=======
</manifest>>>>>>>> Added
Android Studio supports various device types and tries to merge your manifest with default mobile device type manifest, it leads some problems like yours. I hope they have solved it with non-beta version.
The idea is you should have a manifest structure like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ctic.android.screenswapper"
.
. >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
.
<activity1 .....>
<activity2 .....>
.
.
</application>
</manifest>
But merge tools, especially the one that Android Studio use doesn't work well. So you should delete extra lines that came with the merge and your final manifest should look like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ctic.android.screenswapper"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".BasicScreenActivity"
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=".StartCameraActivity"
android:label="#string/title_activity_othar_screen" >
</activity>
<activity
android:name=".GpsActivity"
android:label="#string/title_activity_gps" >
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
<activity
android:name=".HelpActivity"
android:label="#string/title_activity_help" >
</activity>
<activity
android:name=".AboutAppActivity"
android:label="#string/title_activity_about_app" >
</activity>
<activity
android:name=".HowToUseActivity"
android:label="#string/title_activity_how_to_use" >
</activity>
<activity
android:name=".AlertActivity"
android:label="#string/title_activity_alert" >
</activity>
<activity
android:name="ctic.android.screenswapper.StartCameraActivity"
android:label="#string/title_activity_start_camera" >
</activity>
</application>
</manifest>
I hope this one helps.

android how to change the starting activity

I have built an application with one activity for android. I now want to add a LOGIN page which should be run first. how can I change the application to run login first?
my first activity was MainActivity.java. I went to the application's properties -> run/debug settings -> edit conf. -> Launch action. But there is only Mainactivity, I cannot see Login activity.
I am using Eclipse, by the way.
Is there an easy way to fix this?
Modify the manifest:
<activity
android:name=".YOUR_LOGIN_ACTIVITY"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and modify entry of MainActivity as
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
Update
You should read Declaring the activity in the manifest and use of intent filters for more. [Search for 'Using intent filters']
Inside your AndroidManifest change following line: android:name="com.example.webviewdemo.MainActivity" put your login Activity with including package name like com.example.login.LoginActivity.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.webviewdemo"
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.example.webviewdemo.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>

Categories

Resources