What is wrong with my AndroidManifest.xml? - android

I am trying to develop a basic app to display information in 2 tabs, and from my understanding the info in each tab needs to have its own activity, in addition to the one for the tabs. I have done this, all of the java code looks right, and I have declared all 3 activities in my AndroidManifest.xml. When I launch the app, it crashes on start, and when I run logcat, I find:
java.lang.RuntimeException: Unable to start activity ComponentInfo{android.wingdom.convention/android.wingdom.convention.TabWidget}: android.content.ActivityNotFoundException: Unable to find explicit activity class {android.wingdom.convention/android.wingdom.convention.Schedule}; have you declared this activity in your AndroidManifest.xml?
I keep doublechecking the file, and I dont see anything wrong, it currently looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.wingdom.convention"
android:versionCode="1" android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TabWidget"
android:label="#string/app_name"
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 android:name=".Map" />
<activity android:name=".Schedule" />
</activity>
</application>

You are defining activities in your activity.
Try the following code instead:
<activity android:name=".TabWidget"
android:label="#string/app_name"
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=".Map" />
<activity android:name=".Schedule" />

Related

Why I am getting error with my activity in android?

I declare both of my activity class in AndroidManifest.xml file them when I run my application it stop unfortunately with this error message:-
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidtutorialpoint.androidobservablescrollview/com.androidtutorialpoint.androidobservablescrollview.ParallaxToolbarScrollViewActivity}; have you declared this activity in your AndroidManifest.xml?
This is my manifest file:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
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=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>
</application>
</manifest>
My Activity class names are:-
MainActivity
ParallaxToolbarScrollViewActivity
Clean your build and rebuild the project. If you are using instance run android studio feature then disable this for avoid this problem
You placed it in the wrong location it should be inside the application tag. All your <activity... /> tags should be placed under the <application.. /> tag.
Hope this helps!
Remove
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
otherwise change your package name insted of
com.androidtutorialpoint.androidobservablescrollview
Remove intent-filter tag from your second activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.doctormobileapps.androidobservablescrollview">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
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=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
</activity>
</application>
</manifest>
Put intent filter to single activity which you want to start first. If launching activity is MainActivity, then remove intent filter from ParallaxToolbarScrollViewActivity. Or recheck the category line **
"com.androidtutorialpoint.androidobservablescrollview"
**
<activity
android:name=".ParallaxToolbarScrollViewActivity"
android:label="#string/title_activity_parallaxtoolbarscrollview"
android:theme="#style/AppTheme.Toolbar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.androidtutorialpoint.androidobservablescrollview" />
</intent-filter>
</activity>

Merging android manifest files, conflicting filter

I'm trying to combine android manifest files from 2 plugins in Unity, but there are two activities with the same intent-filter and I can only get 1 or the other to work at the same time....
Of the 2 conflicting activities, whichever is on top in the manifest file is the one that will work. So if activity from manifest #1 is on top, plugin #1 will work but not #2, and vice versa.
The two conflicting activities are:
<activity
android:name="com.devfo.andutils.DevfoUnityPlayerActivity"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
is there any way I can merge the two and get them to work from the same app? I'm using Unity 3d.
For example in the manifest where you want to use only the first activity as launcher you have to add this 2 modifications:
At the beginning of the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
And for the activity for which you want to remove the intent filter add this code:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter tools:node="removeAll">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The important part is to add the tools:node="removeAll" attribute in the intent-filter tag
Declare your manifest header like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
And then add one of the following appropriate attributes to the relevant Activity(s):
tools:merge="override"
tools:merge="remove"
Slightly different to #amarkovits answer, I've found success with:
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity"
android:label="#string/app_name" android:screenOrientation="portrait"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
tools:node="merge">
<intent-filter tools:node="remove"> ...
which I believe will try to merge it first, then replaces just the intent filter causing both Icons on the launcher screen
The Activity that has this intent-filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
is the main Activity that will start on application start up, you can't make both activities work at the same time.
what you should do is let only one Activity ( your main one have this filter) and leave the other one without it.
the second Activity will also be part of the application, but it will not be the first Activity you will see. You can start it by using the startActivity() method.
I have done this, the solution is that when you have multiple flavors, like
1. flavorA,
2. flavorB
and main application id is - com.android.vivek
and main flavorA is using com.android.vivek
and second flavorB is using com.android.vivek.flavorb
flavorA's manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.vivek">
<application xmlns:tools="http://schemas.android.com/tools"
android:allowBackup="true"
android:icon="#mipmap/flavorA_ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon" />
<activity
android:name=".ActivitySplash"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
then simply flavorB's manifest mention like below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.vivek">
<application xmlns:tools="http://schemas.android.com/tools"
android:allowBackup="true"
android:icon="#mipmap/flavorB_ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon" />
<activity
android:name=".flavorB.SecondActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActivitySplash"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter tools:node="remove">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
when you run flavorA or flavorB then it will work fine

Quick search in android application

I am making an android application that needs to display a simple quick search, but to do this i need to change the:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
To:
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
But once I do, the application doesn't find a launcher activity, how can i fix this? This is the code that i am using:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mysoftwaremobileapps.School"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="3" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".SchoolActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<activity android:name=".GoogleActivity" android:label="#string/app_name"></activity>
<activity android:name=".WikipediaActivity" android:label="#string/app_name"></activity>
<activity android:name=".ProjectsActivity" android:label="#string/app_name"></activity>
<activity android:name=".NotesActivity" android:label="#string/app_name"></activity>
<activity android:name=".SearchFunction" android:label="#string/app_name">
<intent-filter android:label="ACTION_SEARCH"></intent-filter>
</activity>
</application>
There is no reason for a LAUNCHER to exist in a searchable activity.
The point of a searchable activity is that after a search is triggered by the user, your activity then receives the search query, searches your datastore, and finally presents the results.
Now if you wanted a separate activity that does something related to your datastore, for example input or import data, then by all means go ahead and create another activity and assign LAUNCHER to that activity. The searchable activity isn't meant to be a LAUNCHER activity.

Android: No Launcher activity found! was working before

I have the same problem everyone reports but this began happening suddenly. My app was working as expected, automatically launching the MAIN activity.
But all of the sudden it stopped working and I started seeing the No Launcher activity found! message.
This is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xitrica.android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#style/Theme.Transparent">
<uses-library android:name="com.google.android.maps" android:required="true" />
<activity android:name="ElBusetonActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="andoid.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="RouteInfoActivity"></activity>
<activity android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:name="GetDirectionsActivity"></activity>
<activity android:theme="#android:style/Theme.Dialog"
android:name="PointProviderList"></activity>
</application>
</manifest>
Sorry if I'm not posting this snippet correctly. It's the first time I ever post a question.
Thanks in advance.
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
try this, prefix (".") on activity name
here (.) refer to package path
Remove
category android:name="android.intent.category.DEFAULT"
as it is not required.
Say if you have the Activity names TestActivity
If you want the TestActivity to be the first to launch when you hit "run", simply add two lines:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
To the position like below in your AndroidManifest.xml:
<activity
android:name="TestActivity"
android:label="#string/name"
android:screenOrientation="portrait" >
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
use the dot before the activities in your manifest to declare it. or you can write the package name dot your activity name.
like this.........
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
if you not using package name then it decide the default one.

Starting activities problem? Theme problem

I got some very strange problem:
Let's say I've got two activities.
If I launch each one of them as the main activity of the application - everything seems great.
But if I launch, let's say activity A from activity B. Activity A has the same theme settings as activity B.
Why is this happening?
Activity A is translucent, and if I start the application from activity A - it is transparent, but if I start it from activity B - it is not??
This is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gg.thesis.gallant.command" android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".viewall.A" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask"
android:theme="#android:style/Theme.Translucent">
<intent-filter>
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
</intent-filter>
</activity>
<activity android:name=".viewall.B" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
....
Is there any theme inheritance for the activities in Android?
Thanks!
write one line in your second activity tag....
android:theme="#android:style/Theme.Translucent"
<activity android:name=".viewall.B" android:label="#string/app_name"
android:clearTaskOnLaunch="true" android:launchMode="singleTask"
android:theme="#android:style/Theme.Translucent">
</activity>
may be work...

Categories

Resources