I am having issues with Eclipse. I'm new to Android development so I wouldn't be surprised if I messed something up along the way.
My app installs twice on my phone. When I click 'Run', Eclipse does the usual with installation, but when it is finished, the app shows up twice (ie. two separate icons) on my phone. Any ideas what the problem is?
In your manifest:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.myapp.FirstActivity"
android:theme="#style/Theme.Apptheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.SecondActivity"/>
</application>
make sure only your first activity has an intent-filter.
Uninstall both programs from the emulator. If you change the name of the program and/or change some of the settings, then it can install as a different program. My guess is after you do the install, then run that you'll only have the one icon.
Did you run two different versions of this code?
If so it will not save over the old icon but make a new one.
If this is the case trying deleting boths apps from the emulator and re-running it cleanly.
In my case I had two activities with the following intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
Related
I'm new to android and I have encounterded a problem.
The console said that "Could not identify launch activity: Default Activity not found".
I have add
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
in manifests.
And I have tried Invalidate caches/Restart,still not worked.
And the class file which contains the main activity turn green in android studio. I don't know what that means.
This is my manifests file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mrrobot.mycoolweather" >
<uses-permission android:name="android.permission.INTERNET"/>
<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.mrrobot.mycoolweather.activity.ChooseAreaActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</Activity>
</application>
</manifest>
The chooseAreaActivity is the one I want to use as launcher activity.
For main activity in your manifest you have to add this with category LAUNCHER (First Activity on launch app):
<activity
android:name=".MainActivity"
android:label="YourAppName"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For other activity you have to change category to DEFAULT:
<activity
android:name=".OtherActivity"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="package.OtherActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Check this Activity and this Start Another Activity
So your code is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mrrobot.mycoolweather" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".activity.ChooseAreaActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Although the question is kind of outdated, I would add the following to all the given answers:
For multi-module projects check carefully that you modify the Manifest corresponding to the Configuration you are trying to run.
Had the same problem and spent 20 minutes just to discover that I was trying to run wrong configuration (with an Application in ModulbeB, while thinking that I was running one from ModuleA).
And sometimes you are working on other module default runnable module changes so you have to change it.
Sometimes it is solved just restarting Android Studio
I had the "Default Activity not found" problem a couple of times and I could solved restarting my android Studio.
If you see that error occur after upgrading your IDEA, upgrading Android Studio version, or Generating a new APK, you may need to refresh the IDE's cache.
File -> Invalidate Caches / Restart...
In your manifest file there was wrong element name (Activity change to activity) declared
<Activity android:name="com.example.mrrobot.mycoolweather.activity.ChooseAreaActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</Activity>
Change it to:
<activity android:name="com.example.mrrobot.mycoolweather.activity.ChooseAreaActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
When I upgraded Android Studio to 2021.1.1.23 somehow my Run Configuration was switched from app to models, producing this error. Switching back to app resolved the issue for me.
i had these issues with my project:
Default activity not found
xml intellisense was not working
kotlin standard functions were not detecting
All my above issues were resolved by Deleting System cache of Android Studio 3.3 at the home path, and it's working nicely for me,,
Steps:
exit Android Studio
Go to path > C:\Users\YOUR_WINDOW_USER_NAME.AndroidStudio3.3\system
Then you have a \caches folder, delete this caches folder
Now open Android Studio and load your project
Worked for me.. i wasted couple of hours resolving this issue and finally it got resolved in this way.
Exit your android studio IDE. Then locate the "caches" folder in .AndroidStudio3.2 folder.
Location
C:\Users\YOUR_USERNAME\.AndroidStudio3.2\system\caches
For example.
Let's assume say YOUR_USERNAME is called Admin.
C:\Users\Admin\.AndroidStudio3.2\system\caches
Delete the caches folder and start your android studio IDE.
I have tried solutions here and other questions
clean & rebuild & invalidate and restart
make sure that activity has LAUNCHER as category
delete Android cache folder
at End, activity tag was has <activity android:name="com.exmaple.todo.MainActivity" />
when i changed it to <activity android:name=".MainActivity" /> app worked.
I hope it help you if other solution not work.
If your activity is in a different module (e.g. ':library) und you forgot to specify the subproject in the dependencies{} scriptblock of your :app module,
the manifest of :library and therefore the activities it declares, are not imported.
dependencies {
api project (':library')
You may check whether all activities show up in your app-debug.apk by using the following Android Studio menu command:
->Build->Analyze APK->app-debug.apk
Now open the AndroidManifest.xml and check its activity declarations.
I got this error in android 12+ after changing launch activity adding intent-filter but not make it exported.
so not forget.
android:exported="true"
It is likely that the action is not in the manifest.
This is the fix
Attached is an image
My main activity was not declared in Android Manifest File. That's the reason which came that error. This error come because of a declaration problem of Android Manifest file. Please check it. :D
This happened to me aswell took me ages to figure out why, but a weird bug I spotted is that if you run the app with breakpoints in your code without debugging mode it will cause this error to happen.
Quick fix for now: Only use breakpoints for degbugging mode.
Check your duplicate initialize activity in your AndroidManifest.xml
Like bellow:
<activity android:name=".nim.qiaqia.lota.LotaProduct"/>
<activity android:name=".nim.qiaqia.lota.LotaOrderDetail"/>
<activity android:name=".nim.qiaqia.main.activity.RechargeListLotaActivity"/>
<activity android:name=".nim.qiaqia.lota.MiningCoinLota"/>
<activity android:name=".nim.qiaqia.lota.LotaOrderDetail"/>
that can causes ""Default Activity not found" also. So, remove it and see. its works! :)
In my case android manifest was correct. I tried to invalidate Caches and restart but not worked. Then Rebuild project and it also did not work.
Then I realized that last night I added a new library to build Gradle, it was this:
implementation 'com.yalantis:eqwaves:1.0.1' And after removing this everything worked fine.
TIP: "Always have a track of things you do in your project, otherwise you will end up wasting your time"
If you only enabled building the app via app bundle, then this error might also occure when you try installing it as a default APK. Change the deployment option to APK from App Bundle and you are good to go.
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.
I have just created an Android app in Intellij. It works beautifully on the emulator, which is the same version of Android as I have on my phone (2.3.3) However, when i install the apk file on my phone, it installs fine, but then you can't open the app.
What I mean is that the install finishes and you have a done option but open is grayed out. There is no item in the menu, and there is no shortcut made. I have this in the manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<application android:label="#string/app_name" android:icon="#drawable/icon" android:enabled="true">
<activity android:name="PhlogMain"
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=".PhlogEditNotes"/>
<service android:name=".PhlogListenerService"/>
</application>
I have the Samsung Galaxy Ace S5830 phone.
So after much work I rebuilt the whole thing, changed the keys and tried again and it worked. I am not really sure where it started to work but at least it is now! :-)
I have exported my app from eclipse and installed it on my phone. After installation, I click open from package installer, but the installer force close. Afterwards, when I tried to launch the app, nothing happen after I click it. I click the app in app drawer but it return to home screen instead.
I am able to run in emulator and in debug mode when I connect my device via usb, but not when I export the apk to install.
Note that this is not the first app that I exported to install. Previous apps are working fine.
I found the problem! I had declared the activity 2 times in the manifest with different properties, like:
<activity android:name=".myclass"></activity>
and
<activity android:name=".myclass" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Remove the unwanted one from the manifest and it will work.
Check your android emulator version and the firmware version of the phone. If firmware version is not supported for that app you will be install from adb, but you cant start the app.
Check the settings to be able to install the unknown apps in
Settings->Applications and check box "Unknown Sources"
Try to check on permission in Android Manifest. I was having the same problem earlier when i install a NFC app. I forget to give permission for NFC. After i gave the permission it works fine for me. Please check your AndroidManifest.
I spent few days to identify the problem why it occurred .But I solved my problem this way- Modification in Android Manifest
<activity android:configChanges >
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<I removed my code here that i added for reference to google play store for reference >
Remove the unwanted one from the manifest and it will work.
Try to search errors in your Android manifest, i have the same problem and the problem was the 'R' in the category LAUNCHER are in lower case.
like this:
<category android:name="android.intent.category.LAUNCHEr" />
to solve it, simple:
<category android:name="android.intent.category.LAUNCHER" />
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Removing the configuration of all the modules that are not from the app worked for me. In other words, just leave the Project.app module and check its configuration.
Edit Run/Debug Configurations -> Android app -> app
GL
if you use splash in react native:
To avoid error: Binary XML file line #XXX: requires a valid src attribute
inside a layer-list, use:
<item android:drawable="#drawable/image" />
instead of:
<item>
<bitmap android:src="#drawable/image"/>
</item>
My solution is to add this flag in download manager when application is install
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
In my case - i had this flag -> intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
I replaced it with Intent.FLAG_ACTIVITY_NEW_TASK and everything worked!
My Manifest looked like this. Those that need help and have a similar manifest look bellow.
<activity android:name=".login.activities.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="example.com"
android:scheme="https"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You just need to remove the
< data>
element in the intent-filler and it should work.
I have my Emulator open, and using Command Prompt I remove my application. I didn't closed the Emulator.
Then I go to Eclipse and hit Debug, but doesn't deploy the apk to the emulator, just tells me the package not yet registered with the system.
New package not yet registered with the system. Waiting 3 seconds before next attempt.
Restarting the emulator is not an option, as that takes 10-15 minutes.
What I am doing wrong?
I have encountered this occasionally. Doing a clean project before rebuilding and redeploying seems to do the trick.
This is eclipse (the point is eclipse can not run your app because can not start the right intent because can not find the right package) and one of the workaround of this is to rename your package in the manifest for example rename
package="com.hernblog.GreenThumbs"
to
package="com.hernblog.GreenThumbs1"
compile and build this, then put it back to the name you wanted
package="com.hernblog.GreenThumbs"
works as a charm :)
Clean and re-build may not help.
So, in that case remove the app from your device.
Then re-run your project on your device. That will help.
After trying many different solutions for this problem, I found that the line
<application android:debuggable="true" />
in my AndroidManifest was causing this problem.
Removing this line fixed it for me.
Note: You can still build with debugging mode without this line by using the ndk-build option NDK_DEBUG=1
im also having same problem.
I just commit my src,res folder in svn.
Then i check out new project from svn then it will works correctly.
Also check your "Enabled" option in manifest! Mine turned to off, somehow ..
I have also had this problem.
For me it was the fact that my launcher activity (the one with the Launch intent) did not have the "android:label" attribute
WRONG!!!
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:name=".ui.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.DashboardActivity"
android:label="#string/app_name">
</activity>
<activity android:name=".ui.LogListActivity"></activity>
</application>
RIGHT - Note the SplashScreenActivity
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:name=".ui.SplashScreenActivity"
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=".ui.DashboardActivity"
android:label="#string/app_name">
</activity>
<activity android:name=".ui.LogListActivity"></activity>
</application>