Getting error when launching application in Android Oreo - android

I'm facing the following error:
Error while executing: am start -n
"com.package/com.package.SplashActivity" -a android.intent.action.MAIN
-c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.package/.SplashActivity
} Error type 3 Error: Activity class
{com.package/com.package.SplashActivity} does not exist. Error
while Launching activity
So what can I do to resolve this issue
Android 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.company.xyz">
<application
android:name="GoogleAnalyticsApp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/MyMaterialTheme">
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait">
<!-- For Pushwoosh we have to set following code: -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name=".MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>
</manifest>
I have added Manifest file also in that you can see what I need to change and I am using push for notification.
Thanks for the help in advance.
Edited : com.company.xyz packagename which is same in other build.gradle and manifest
I have checked both files are having same package name and the application is running in all device but when i try to run it on OREO it not launching activity.

OP, Have you found a solution for this?
I had the same issue using a splash screen in android o. It was caused by the custom theme I was using before O. Are you using a custom theme for that activity?
If so, this solution might help you.
The custom theme had this code
<item name="android:windowBackground">#drawable/background_splash</item>
but android O seems to crash with it so try this solution that I used to solve my issue
Create a new value-v26/styles.xml then add the code below in that xml
<style name="Splashscreen" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowSplashscreenContent">#drawable/splashscreen</item>
Replace the background drawable with your own.
The full detail of the solution is from this post by Omkar Amberkar

make sure in android manifest file in your SplashActivity is call first like below code..
<activity
android:name=".activity.SplashActivity"><!--activity is package name. hear pass your first activity to load app start-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Activity class {com.package/com.package.SplashActivity} does not exist.
I think the activity class package name or the manifest declaration along with the fully specified package name is missing in your case.

Related

Single Activity intent.action.VIEW with Crashlytics-Beta causing two instances of App running at same time

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>

How to add app shortcuts in my app

I have been looking into building a app to replace the homescreen on android, I need to know how to add the option to add app shortcut to my app.
In your app's manifest file (AndroidManifest.xml), find an activity whose intent filters are set to the android.intent.action.MAIN action and the android.intent.category.LAUNCHER category.
Add a <meta-data> element to this activity that references the resource file where the app's shortcuts are defined:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<application ... >
<activity android:name="Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
</activity>
</application>
</manifest>
You can find the rest here - https://developer.android.com/guide/topics/ui/shortcuts.html
Hope this helps!

Incorrect application label when using android library

I am having an issue with the naming of the application when the label string comes from an android library in a multi module project.
Here's some code
application/src/main/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.android">
<application
android:name=".MainApplication"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name">
<activity
android:name=".main.MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="mycompany"/>
</intent-filter>
</activity>
</application>
</manifest>
application/src/main/res/values/strings.xml
EMPTY. All application strings are coming from the library.
library/src/main/res/values/strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">MyAppName</string>
...
</resources
Result:
The application is named Library instead of MyAppName in the application launcher once it's installed in any device.
Things I tried/did:
Added same label than the application to the activity with android.intent.action.MAIN intent filter
Moved #app_name string to application/src/main/res/values/string.xml. This does work, but is not ideal in my case as translations are managed entirely in a different module.
The rest of the strings in the application are correctly being picked up from the library
Searched for the string Library and I did not find it anywhere in all my code.
Suggested by #azizbekian: Added tools:replace="android:label" to both application and main activity manifest tags
Any clues? Thanks in advance.

Launch a Library Activity From Project Manifest

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>

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