I'm programming an app with sqlite+JSON, but suddenly I couldn't Run it anymore, and it popped this message, here's my AndroidManifest.xml , Idk if there's something wrong with it, my main activity is called DatosActivity, I wish you could help me.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hitan.practica2_u3">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="com.example.hitan.practica2_u3.DatosActivity"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
</manifest>
You should add category.LAUNCHER & action.MAIN .
<activity
android:name="com.example.hitan.practica2_u3.DatosActivity"
android:theme="#style/AppTheme.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This error is coming because you have not added the default screen which should execute first. So try adding following code snippet, and your problem will be solved:
<activity
android:name="com.example.hitan.practica2_u3.DatosActivity"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope it helps.
Please Add Intent Filter Tag in Manifest To Make It Default while Launching.
Add this intent filter inside your activity tag
<activity
android:name="com.example.hitan.practica2_u3.DatosActivity"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Related
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>
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
When i add screens(src folder) info in manifest file i got this warning "Exported activity does not require permission" , but can't able to solve this problem.Can anybody provide solution for this.
Please suggest me how add screens(src folder) in Manifest file
<application android:allowBackup="true" android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:name="com.projectmine.Simpleproject">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
>
</activity>
<activity
android:name="com.projectmine.MainActivity">
<intent-filter>
<action android:name="com.projectmine.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
Please try this:
<application android:allowBackup="true" android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:name="com.projectmine.Simpleproject">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.projectmine.MainActivity">
</activity>
Add
android:exported="false"
to your Activity definition
Edit: you can have more information about android:exported on : Android Guide
also as rIHaN JiTHiN 's answer it might occurred because of intent filters of your MainActivity
This is an erroneous warning, that has been filed a related issue here by CommonsWare for that should be fixed someday.
For similar thread visit here
I made a android app and it worked very well, but there are two icons in my device screen. I think it could be a AndroidManifest problem. Any idea what it could be?
This my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pk.aeh.ideos.taa"
android:versionCode="1"
android:versionName="1.0" >
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".Ghinho_congviecActivity"
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="Nhap_congviecActivity"></activity>
<activity android:name="Sua_congviecActivity"></activity>
<activity
android:name=".Quizzes"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".PlayGame" />
<activity android:name=".Result" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This could be because you have declared two activities as MAIN and LAUNCHER
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your Androidmanifest.xml file. You need to have only one activity with these intent filters so that when the app is installed the system will know which activity is to be used as the main launcher activity.
It is. You have two of these:
<category android:name="android.intent.category.LAUNCHER" />
Get rid of the one you don't want.
You need to make these changes to your Manifest.xml
<activity
android:name=".Ghinho_congviecActivity"
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="Nhap_congviecActivity"></activity>
<activity android:name="Sua_congviecActivity"></activity>
<activity
android:name=".Quizzes"
android:launchMode="singleTask">
</activity>
I am assuming that the Activity with the attribute android:label="#string/app_name" might be your main activity.
It could be because you have changed your package name and installed it twice with different package names.
Remove the intent filter of one the activity and it would work perfectly.!
Your manifest file should only have one activity with below Intent Filter, Activity which you want to have an icon:
<intent-filter>
<action android:name = "android.intent.action.MAIN" />
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
Based on your description, it sounds like two activities have this line. Check your Manifest...
You can declare only one Intent filter in the activity, on AndroidManifest.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you used two or more intent filter in AndroidManifest, then you will have display 2 app icon, So remove it & set one intent filter.
I hove this is usedful to you.
In my project when application is get installed it naming the app name as {#string/welcome_msg} not {#string/app_name}. Is there any way to make the application name not same as Main Activity label?
Below is my manifest code:-
<application android:theme="#style/AppTheme" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".StartActivity" android:label="#string/welcome_msg">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" android:label="#string/login">
<intent-filter>
<action android:name="com.gymup.project.LOGINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
Change the label in your manifest to the app's name, then in your code use
this.setTitle( R.string.lable );
on onCreate(..)
You're avoiding the real question here:
How to get ride of title bar?
Answer:
In activity entry of manifest:
android:theme="#android:style/Theme.NoTitleBar"