I checked plethora of similar posts related to this topic but non was able to point out the issue which I am facing.
So basically I have a Module having a Launcher activitywhich I don't want to be the main Launcher by overriding the Main Module's Launcher Activity. So, I used the node: tools:node="remove" to remove that. Example:
Main App's manifest:
...
<activity
android:name="path.ThatOneActivity"
android:screenOrientation="locked"
android:theme="#style/AppCompatTheme.Translucent.NoTitleBar">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="nextActivity"
android:value="path.ThatOtherActivity" />
</activity>
My Module's manifest:
<activity
android:name="path.ThatOneActivity"
android:screenOrientation="locked"
android:theme="#style/AppCompatTheme.Translucent.NoTitleBar"
tools:node="merge">
<intent-filter tools:node="remove">
<action
android:name="android.intent.action.MAIN"
tools:node="remove" />
<category
android:name="android.intent.category.LAUNCHER"
tools:node="remove" />
</intent-filter>
<meta-data
android:name="nextActivity"
android:value="path.ThatOtherActivity" />
</activity>
So, as you can see, this is actually a mixture of multiple solutions on different threads but it is not working. (Yes, not even individually).
I then checked the logs while building, I found a warning:
category#android.intent.category.LAUNCHER was tagged at AndroidManifest.xml: to remove other declarations but no other declaration present
This is now confusing as I am not sure what it means. As per other threads, I did add the xmlns:tools too but nothing happened:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="my.borning.app">
Update:
Made the changes as per CommonsWare's comment:
<activity android:name="path.ThatOneActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN"
tools:node="remove" />
<category
android:name="android.intent.category.LAUNCHER"
tools:node="remove" />
</intent-filter>
</activity>
but still getting the Warning:
category#android.intent.category.LAUNCHER was tagged at AndroidManifest.xml: to remove other declarations but no other declaration present
I figured one thing though:
I am working on a module which is used by the main app (which is also not managed by me, my module is a library which I had it wrong before. So this has to do with the Priority! Mine being the library trying to override the Launcher of the Main App which is using my module as a Library. Is there a way to override the Launcher via a library (basically if we can make it's Manifest's Priority higher, which doesn't sound possible)?
It would be helpful if you can guide me to a concrete direction. Let me know if you want more details.
Thank you in advance!!
Related
I am coding an application for Android Automotive OS. It is a simple Hello World for now, but that is not the problem of the app so far.
To run the app in the in-built automotive emulator of Android Studio (I use the Canary version of Android Studio Electric Eel | 2022.1.1 Canary 10) I had to download an app called Google Automotive App Host, gonna refer to them as GAAH from now on, to be able to run my own created app. So far so good.
Now I came across a "problem" in my AndroidManifest.xml which says:
Implement permissions on this exported component. in the <service> section:
<application
android:allowBackup="true"
android:icon="#mipmap/example_icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/example_icon_round"
android:supportsRtl="true"
android:theme="#style/Theme.Example">
<meta-data
android:name="androidx.car.app.minCarApiLevel"
android:value="1" />
<service
android:name="com.example.launcher.services.LauncherService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService" />
</intent-filter>
</service>
<activity
android:name="androidx.car.app.activity.CarAppActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="#android:style/Theme.DeviceDefault.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="distractionOptimized"
android:value="true" />
</activity>
</application>
Most of the answers stated, that android:exported should be set to false, which makes sense, so other apps don't have access to my own app.
The problem is, it also includes the aforementioned GAAH, which I need to be able to run it at all. It is not something game-breaking, it is just an inconvenience to deal with.
My question is: Are there ways to fix this issue and retain the ability for GAAH to run my app in AAOS?
Thanks in advance!
Grey
Edit: Expanded the XML section from <service> to <application>
The Google Automotive App Host holds the android.car.permission.TEMPLATE_RENDERER permission, so you should be able to use that as follows:
<service
android:name=(hidden)
android:exported="true"
android:permission="android.car.permission.TEMPLATE_RENDERER">
<intent-filter>
<action android:name="androidx.car.app.CarAppService" />
</intent-filter>
</service>
Additionally, you can further refine which hosts you trust by overriding the CarAppService::createHostValidator method.
i have run into very strange behavior of crashlytics beta when tester claims he is able to run two instances of app at the same time.
Log is telling me that its completely same packageName so we cant distinguish from which that log came.
I did some research and beta is propably running it inside their app with something like this:
Intent i = getPackageManager().getLaunchIntentForPackage("com.package.ofapp");
startActivity(i);
with combination of action.View in manifest its causing to run two instances of the app
<activity android:name="com.kebab.KebabApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
So i would say its ok. Just lets get rid of the action.View.
<action android:name="android.intent.action.VIEW" />
After that its start screaming at me:
App is not indexable by Google Search; consider adding at least one
Activity with an ACTION-VIEW intent-filler. See issue explanation for
more details.
So i have to put ignoring GoogleAppIndexingWarning into lint because i am using google single app standard combining with crashlytics beta ?
Here is my manifest #HB
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="package">
<!-- permissions -->
<application
android:name="package"
android:allowBackup="true"
android:icon="${appIcon}"
android:label="#string/app_name"
android:roundIcon="${roundIcon}"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="package.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The problem I have is that if I have in the base Manifest file an Acitivity, say like so:
<activity
android:name=".activities.ActTutorial"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.NoActionBar"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
After I merge the manifest files, produce the apk file and open this apk file (using apktool) to look at the AndroidManifest.xml file I see this:
<activity
android:theme="#*android:style/Theme.Holo.NoActionBar"
android:label="#string/app_name"
android:name=".activities.ActTutorial"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
The android:theme value changed from:
"#android:style/Theme.Holo.NoActionBar"
to
"#*android:style/Theme.Holo.NoActionBar"
As you can see there is an asterisk (*) there and this basically result in showing me an activity with ActionBar when in fact I need one without.
Does some one knows why this happens? and this can be fixed?
In the end the asterisk was not my problem for this thing, but I had some problem with the application package names, what helped in this case was to use:
${applicationId}. place holder in the manifest file for different packages of the different flavor of the project.
You can use it like so:
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission
android:name="${applicationId}.permission.C2D_MESSAGE"/>
Hi I have an activity defined in my Library like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I then want to use this library to launch with in another application which I am doing like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However when I am going to build it it comes back with...
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.company.application/.corelibrary.recording.DesiredActivity }
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error type 3
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error: Activity class {com.company.application/com.company.application.corelibrary.recording.DesiredActivity} does not exist.
com.company.application is my project package.
com.company.application.corelibrary is my library package.
I have included the library in my project.
What am I doing wrong?
ADDITION
I just renamed my library project's package name to something different than that of my project as I thought maybe as they were similar the project may look in it own source for the class but this did not work either.
in my application, i have wrote activity in manifest like:
<activity android:name="MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
i have also declare another activity (which activity belongs to my library) in the manifest as:
<activity android:name="com.facebook.LoginActivity"
android:label="#string/app_name" />
hope this will help u.
N.B:
u should not use
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
for two activity in a manifest.
I thought I would answer my own question. The other answers may be valid but this is what solved mine.
Before my activity declaration in the new projects manifest I had the following which was causing issues.
<uses-library
android:name="com.corecoders.st.corelibrary"
android:required="true" />
I removed that, cleaned and rebuilt the project and it launched fine.
I have solved this issue by implemeting he solution io.card does in their library. By wrapping with the application tags the activities into your library manifest.
<application>
<activity
android:name="com.eckoh.eckohroute.ActionConsumingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/Theme.Dialog.ActionActivity" />
</application>
I got this warning from console when running my application on emulator
No Launcher activity found!
The launch will only sync the application package on the device!
In fact i have declared an activity as the main launcer in AndroidManifest.xml file
<activity
android:name=".myActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I don't need any other intent-filter to use on that activity.. just basic main and launcher
What's the reason? Please give me a solution..
If the launcher activity is in another package, you will need to specify that as well.
For instance, from one of my personal projects:
<activity
android:name=".activities.MainScreen"
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 MainScreen.java is in the activities package. Also, check spelling for upper or lower case letters.
It seems that you must have "android.intent.action.MAIN" specified immediately before "android.intent.category.LAUNCHER". I encountered the same issue as you when I had the following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The issue was resolved only when I re-orderd as follows:
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In all normal circumstances, listen to what the other guy(s) said.
I was able to replicate your issue using a Mac Book Pro & Eclipse Indigo. when you create your android project, you MUST have Eclipse start you off with a templated activity (like a blank activity). if you don't, and you try to add an activity to your manifest later, Eclipse just derps and can't find the launcher. (i looked at other manifest files and i can't see any differences. i really don't think it's your poor manifest's fault in this special case.)
here's your lazy easy fix:
start a new project, and copy over all the files (make sure you back up ur files first, in case you delete something wrong or mess up the ordering)
Using Eclipse Indigo, open Run Configurations windows, click the project and use launch default activity on Android tab, choose Automatically pick compatible device...and apply.