Launch a Library Activity From Project Manifest - android

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>

Related

How do I fix this error in Android Studio?

I've been getting this error every now and then, and once I thought it was fixed, it just came back:
Error while executing: am start -n "com.example.wolfixfinal/com.example.wolfixfinal.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.wolfixfinal/.MainActivity }
Error type 3
Error: Activity class {com.example.wolfixfinal/com.example.wolfixfinal.MainActivity} does not exist.
Error while Launching activity
Failed to launch an application on all devices
I've made two or three other questions about this topic and it's getting annoying. I've tried removing the gradle and .gradle folder, removing the .idea folder and then rebuilding the project. I don't know what to do anymore.
How do I keep this from not happening, is it something I have to do all the time everytime I see this error.
Make sure than only ONE of your activities has the LAUNCHER and MAIN properties in your Manifest file. This file can be found under Android Project view: app > manifests > AndroidManifest.xml. The one you want to boot in is the one that should have these properties.
Like this:
<activity
android:name=".Splash"
android:exported="true">
<!--This will be the starting activity you want-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="true"/>
NOT like this (2 activities in the manifest both have:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
):
<activity
android:name=".Splash"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported`

Please help me with this error getting in my project while trying to run at mobile via android studio.
Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Add this to your manifest to the activity tag in the error message:
android:exported="true"
This happens when your activity can be started by another application. For example image viewer can be started by file manager when clicking an image. The image viewer app is "exported".
It's also always required if you are using the following code necessary for dynamic links:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
Example:
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
I found this solution!!.
So you have to add the android:exported="true" into the activity tag in the manifest (not in the application).
<application
android:fullBackupContent="#xml/my_backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name">
<activity android:name=".yourActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".otherActivity" android:exported="true"/>
</application>
To see more information about the exported property, see App manifest file activity
:)
if you are using flutter ,may some deprecated lib in your ap is causing this ..
for me: upgrading flutter_local_notifications to the latest version (now is 9.3.2) solved this error..
If you have any activity, service, receiver, or provider that does not have exported set in your manifest file then add whenever it needed like,
android:exported="false or true"
You had to figure out the component missing the Android exported tag.
You should downgrade your SDK version and check the final merged manifest file for the components missing the exported tag but has IntentFilter.
The step-by-step instructions is provided in this link.
This is for the projects using Bootsplash.
My project used Bootsplash and I solved it by adding android:exported="true" also to the activity of Bootsplash in the AndroidManifest file.
<application
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan"
android:exported="true" // <----ADD THIS
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
android:theme="#style/BootTheme"
android:exported="true" // <----ADD THIS
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Add android:exported="true" into the Manifest file inside of the application activity
<application
<activity
android:exported="true"
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/Theme.NoteKeeper.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Android Studio Error running 'app': Default Activity not found

I am using Android Studio 3.4.2 on macOS 10.14.5. Every time I try to run my app, I get the following error:
Error running 'app': Default Activity not found
I tried this solution already (Error: Default Activity Not Found) but it didn't help.
Any help?
If Invalidate Caches/Restart did not help you, then
maybe you forget to declare Your Activity in Manifest
<activity android:name="your.package.YourDefaultActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Try to add this into your manifest, This lines of code tell the system from which activity Application should start, like an entering point of your app
Make sure you register your default activity
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:taskAffinity="" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Also make sure your selected module & default activity is correct

Android name in manifest file shows error

In my Android manifest file "android:name" in both the activities which I have mentioned below shows error when I tried to run the program. How can I fix 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>
<activity
android:name=".ContentView"
android:label="#string/title_activity_content_view" >
<activity>
CLean Project
if it doesnt work,
remove tags and add activity again to manifest

No Launcher Activity found with .Launcher in Manifest.xml already included?

I am trying to run a source code I've found online for android. When I run it, it gives me:
No Launcher activity found!
The launch will only sync the application package on the device!
Performing sync
I already have in my Manifest.xml the following:
action android:name="android.intent.action.MAIN"
category android:name="android.intent.category.LAUNCHER"
What could be wrong? The weird thing is that it worked once. And then when I ran it again it gave me needs to force the application.
It is not a duplicate question because I've read that everyone is suggesting to place those in the Manifest.xml.
I think you need to define a launching activity. For example in my app
<activity android:name=".Main"
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 have defined which activity is started on app start.
please make sur to add android:exported="true" it will be like that
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources