So I am very new to android programming and I was installing a basic app I just built on my android device and I find that it always seems to install two "instances" of the app ? Here is a screenshot of what I am looking at [The two instances are of the SR520 app] :
I did some research and it seems like it could be due to the android manifest file but I am not exactly sure what I should change in it. This is what my manifest file looks like
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SplashActivity" android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Some suggestions would be much appreciated.
Ok I guess I needed to delete this section
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
That fixed the issue.
Related
I made my schedule. I'm installing but the apk is not there. everything is clear in the picture
I made changes to the manifest, is it something related to it?
Manifest
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<category android:name="android.intent.category.LAUNCHER" />
</activity></intent-filter>
</activity>
<activity
android:name=".guzelsozleractivity"
android:label="#string/app_name" />
</application>
You are declaring MainActivity twice.
Declare it like this:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Your manifest was wrongly entered, update the Manifest.xml to the code given below it will work. Please like and accept the answer if it worked.
Happy coding.
<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>
Ok here is the thing I created a project put it on github, then work more on it update it and push updates on github (this is the last version, 2 versions total)...however now whenever I run the app through android studio,(even the version downloaded from github, master) it installs two APPs on my phone...one is the older version and the other is the new version.. How can I remove the old version ? however I only see one android manifest, it seems that both versions are kinda connected together whenever I uninstall, the phone uninstalls them both
EDIT Before fixing
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".TeacherLogin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddUpdateStudent" />
<activity android:name=".ViewAllStudents" />
<activity android:name=".MainActivity" />
<activity android:name=".NoteMainActivity" />
<activity android:name=".AddNotesActivity" />
<activity android:name=".MainMenuActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
After Fixing
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".TeacherLogin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddUpdateStudent" />
<activity android:name=".ViewAllStudents" />
<activity android:name=".MainActivity" />
<activity android:name=".NoteMainActivity" />
<activity android:name=".AddNotesActivity" />
<activity android:name=".MainMenuActivity">
</activity>
</application>
Ok so appearntly the second intent was after the main menu which was the version 1.0 before the update, after the update I added login activity, hence why it looked like "2 apps with different versions" so there was no problem what so ever with git or github as I weirdly thought... I appologize if this question was kinda stupid now after I looked at it but I am really new to this android app development.
If you have two launcher icons, but only one entry in Settings > Apps, that means your one app has a manifest with two <activity> elements that each have the <intent-filter> to cause them to appear in the launcher:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SomeOtherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
That may just be a copy/paste error, or perhaps an accidental checkbox click in the new-activity wizard.
Regardless, unless you really do want two launcher icons, remove the <intent-filter> from the activity that does not belong in the launcher.
I have built the .apk for a little application I wrote for android. On the installation finished screen the "Open" option is grayed out and can not be chosen. After when I search the device for the application no icon appears, if I check installed apps it is there but still cannot be opened. I believe this is a problem with the androidmanifest.xml. I have very little experience with the androidmanifest and mostly just work with java.
<application
android:allowBackup="true" android:label="#string/app_name"
android:icon="#mipmap/ic_launcher" android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="andriod.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Above is my manifest, I understand my manifest probably has many errors so thank you for your help and patients in advance.
The default launcher intent:
<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>
is this a typo ?
intent-filter>
<action android:name="android.intent.action.MainActivity"/>
</intent-filter>
it should be like this
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Your intent-filter is wrong, that's the reason why android won't create an icon. Just have a quick Google lookup or create a new project and copy the intent-filter out of the Manifest.
When I am trying to debug-run my application I am getting this error in console:
Default Activity not foundWaiting for process: com.myapp.myapp
My AndroidManifest look like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.myapp.myapp.Splash"
android:label="#string/app_name"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.myapp.Main"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
This doesn't work for me because I can't find any sources tab as mentioned there.
For the second activity, in intent filter, change android:name to com.myapp.myapp.Main .
I can't find any problem but it keep giving me the error "No Launcher activity found!" and "The launch will only sync the application package on the device!"
can anyone solve this problem???
This is my Maniest
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.saikoro.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.saikoro.StartUp"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.saikoro.StartUp" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
The <activity> element of the activity you want to launch through the icon on the app list must contain both of the following parts of the intent-filter:
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
Your current manifest has an activity with category LAUNCHER and action MAIN, but in different activities. The one with the icon in the app list must have them both.
Change
<action android:name="com.example.saikoro.StartUp" />
with
<action android:name="android.intent.action.MAIN" />