Whenever I try to run my App, it installs two app in the emulator/device. I only want to Install my Main Activity, but the Splash Activity installs also. I know the problem is in the Manifest. Can anyone help me please? Here is my code:
<activity
android:name="com.android.upcurrents.launcher.SplashActivity"
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="com.android.upcurrents.MainActivity"
android:label="#string/app_name" />
You need to have only one activity to be declared as the launcher. So, remove the intent-filter from within the SplashActivity's tag, and add it to your MainActivity. The Launcher intent-filter should be present in only one of the activities in your manifest file.
It installs based on the intent filter you have provided.
Remove the following intent filter from SplashActivity and then put it in Main Activity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
try this:
<activity
android:name="com.android.upcurrents.launcher.SplashActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.android.upcurrents.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>
I had this same problem but I fixed it with the making sure you only have one activity with:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In my code I had two activities with that intent-filter, which caused two applications to be installed on my device.
We have the same problem but i fixed it this way
before my code below in manifest
<application
android:debuggable="true"
android:allowBackup="true">
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.noupdate.apptest_noupdate.MainActivity"
android:icon="#drawable/ic_launcher"
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>
Notice that in the SplashActivity inside the intent is this code
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
i only deleted the category
<category android:name="android.intent.category.LAUNCHER" />
So after i deleted the intent-filter category in splash it didn't install two app icon but only one for main the code will be like this notice that the intent-filter category is deleted
<application
android:debuggable="true"
android:allowBackup="true">
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="com.noupdate.apptest_noupdate.MainActivity"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.NoTitleBar"
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>
it really helps
Related
I have in my AndroidManifest.xml two activities that I could launch
<activity android:name=".ExperimentActivity"
android:label="Experiment">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When I install, there's two icons, Main and Experiment. However, when I launch, both also launch the ExperimentActivity.
Did I miss anything?
Please add the exact package like
android:taskAffinity="com.yourpackage.MainActivity"
and
android:taskAffinity="com.yourpackage.ExperimentActivity"
to your activity tag .
Hope this helps.....
So, normally you only launch the Main Activity, which is declared as your launcher in the manifest. All other activities then get launched from the Main Activity.
You should only declare one Launcher Activity in your manifest.
E.g.:
<activity android:name=".ExperimentActivity"
android:label="Experiment">
<intent-filter>
<!-- declare your own filters if you need them -->
<!-- for example parent activities -->
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I found another way of doing so, which is to add the following to my ExperimentActivity scope.
android:launchMode="singleInstance"
i.e.
<activity android:name=".ExperimentActivity"
android:launchMode="singleInstance"
android:label="Experiment">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:label="Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I'm making a react native app and earlier it was working fine but now when I run "react-native run-android", after the successful install and launch, I can see two apps in the simulator and both of them are working fine.
So, any ideas why I'm seeing 2 apps or should I say why I'm getting an extra duplicate app installed?
I think you added splash screen in your app after it you have this problem, first go to this Dir: android/app/src/main/AndroidManifest.xml if you add two time something like this
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> -->
it will render two times and build two apps on your device.
in my file
AndroidManifest.xml
<!-- remove just first part the activity, but i comment this part -->
<!-- <activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
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=".MainActivity"
android:label="#string/app_name"
android:theme="#style/SplashTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The problem is due to multiple category LAUNCHER in both splash and main activity.
<category android:name="android.intent.category.LAUNCHER" />
The solution with both SplashActivity and MainActivity is to change
<category android:name="android.intent.category.LAUNCHER" />
to
<category android:name="android.intent.category.DEFAULT" />
in MainActivity.
The file with both .SplashActivity and .MainActivity looks like this;
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
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=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
I had this issue as well. It turns out one of RN lib I installed created an extra <activity /> and <intent-filter />tags. Just check your AndroidManifest.xml.
My source: Running app gives 2 app icons in Android Studio - newbie
Change this
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
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=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
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>
To
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
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=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:exported="true"
/>
Basically you have two intent-filters delete one
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
To add to the answer Aras posted above, for me the issue was specifically with the extra intent-filter attributes which were labeled 'MAIN' and 'LAUNCHER'. You can't have more than one occurrence of those without creating duplicate apps, it seems.
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme"
android:label="#string/app_name">
<!-- You'll either want to remove this section, or ensure that it does not exist in any other activities. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Check the package name of the installed apps.
I got this warning from console when running my application on my phone. And my phone haven't any response.
No Launcher activity found! [2016-03-11 14:44:59 - ActivityTest] The
launch will only sync the application package on the device!
Check this -
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You should set action main is caps
i.e <action android:name="android.intent.action.MAIN" />
I think your error comes because you declare this row in your Manifest wrong
<action android:name="android.intent.action.Main" />
Your Manifest must be some like this
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".FirstActivity"
android:label="This is FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/> <-- MAIN with upper case
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
This two lines in your Manifest always must look exactly like that.They are not classes in your app.They are actions that are happening.
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
i declared the report file as my launcher. so its supposed to launch first when the app is started first. or do i get something wrong.
i get the error. no launch activity was found. thx guys
<activity android:name=".report" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.REPORT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Main" android:label="#string/app_name">
<intent-filter>
</intent-filter>
</activity>
You need to change the action:name from .REPORT to .MAIN. The action name corresponds to the intent action and not to the Activity name.
Fixed version of the above:
<activity android:name=".report" 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=".Main" android:label="#string/app_name">
</activity>
New bee to Android, I need help on creating tabs.
I am following the example stated in http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
When I run the application, I am not seeing any tabs but only Songs tab.
I am not able to figure out how to resolve this.
Below code is added under AndriodManifest.xml
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloTabWidget"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".AlbumsActivity">
<intent-filter>
<action android:name="com.example.TabWidget.AlbumsActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".ArtistsActivity">
<intent-filter>
<action android:name="com.example.TabWidget.AlbumsActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".SongsActivity">
<intent-filter>
<action android:name="com.example.TabWidget.AlbumsActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
Make it look something like this:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloTabWidget"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AlbumsActivity"/>
<activity android:name=".ArtistsActivity"/>
<activity android:name=".SongsActivity"/>
</application>
This part:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
is for the entry part of your app.
here is a very simple example for tab-layout:
Andorid Tab-Layout with icons