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
Related
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>
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>
In my android app I use a library project and I use one of it's activities. However in the library project that activity has MAIN action and LAUNCHER category intent-filter. So I added that activity to my manifest and removed the intent-filter. The manifests seem to be correctly merged into build/intermediates/manifests/full/debug/AndroidManifest.xml, and the activity looks as expected (without the intent-filter):
<activity
android:name="com.michaelrnovak.util.logger.Logger"
android:configChanges="orientation"
android:label="#string/show_log" >
</activity>
However when I start the app from AndroidStudio in the emulator, then instead of my AlertsActivity, the library's Logger activity is launched. What am I doing wrong?
This is the manifest of the library:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.michaelrnovak.util.logger"
android:versionCode="8"
android:versionName="1.5">
<uses-permission android:name="android.permission.READ_LOGS" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity android:name=".Logger"
android:label="#string/app_name"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>
and my app's manifest has the following relevant activity definitions:
<activity
android:name=".AlertsActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</activity>
<activity android:name="com.michaelrnovak.util.logger.Logger"
android:label="#string/show_log"
android:configChanges="orientation"
tools:replace="android:label"
>
<intent-filter tools:node="removeAll" />
</activity>
Have you tried tools:node="remove" on the category node only? From my experience, it seems to work.
Something like this:
<activity android:name="com.michaelrnovak.util.logger.Logger"
android:label="#string/show_log"
android:configChanges="orientation"
tools:replace="android:label"
>
<intent-filter>
<category tools:node="remove" android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
I tried many ways on similar situation like you. I figured out that I must add tools:node="replace" in the Activity node to remove intent-filter's specific action and category. Try this :)
<activity
android:name="com.michaelrnovak.util.logger.Logger"
android:label="#string/show_log"
android:configChanges="orientation"
tools:replace="android:label"
tools:node="replace">
<!-- Rewrite the intent-filter you want -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
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.
My AndroidManifest.xml is like the followings:
<application android:label="droid VNC server" android:icon="#drawable/icon"
android:name="MainApplication" android:debuggable="true">
<activity android:name=".MainActivity" android:launchMode="singleInstance"
android:label="#string/app_name" android:icon="#drawable/icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="org.onaips.vnc.ACTIVITY_UPDATE" />
</intent-filter>
</activity>
</application>
I already set the following two lines:
Why I still get the errors
No Launcher activity found
The launch will only sync the application package on the device
Thanks
Your intent-filter tag in xml file should exactly be like this:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Place it inside <activity> tag and you should be ok
Remove the line
<action android:name="org.onaips.vnc.ACTIVITY_UPDATE" />
Because there are 2 similar lines, the 2nd line is usually considered. (Ambiguity). So just remove that line, and you will see the app in the launcher!