My android studio is installing two apps/apks on my phone - java

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.

Related

Installing the debug apk shows up as two apps?

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.

Strange behaviour of an alphaApk's shortcut

I have noticed that my application that is published to an Alpha test has a strange behaviour... The shortcut is launching the MainActivity again. Everything is working fine when it's installed via generated .apk
My Android-Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.YYY.XXX">
<application
android:name=".Infrastructure.XXXApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".activities.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.BaseActivity" />
<activity
android:name=".activities.SettingsActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activities.SavedResultsActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>

android cannot open my app

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.

No Launcher activity found

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" />

My app doesn't show on emulator, when I run the project

when I try to run the project it installs successfully on an emulator, but emulator does not show my app launcher icon in its app menu. but however it shows my app in installed apps in setting>applications>manage applications>all apps , so that means that an app was installed. but it didn't run.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.travis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Make sure your starting activity has its intent-filter declared properly in your manifest to be shown in the launcher.
Assuming you want "Splash" to be your main activity change its declaration to this (specifically the intent-filter action)
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Your intent filter action was not part of the android defaults (and what launchers normally look for). Only launchers that were designed to look for the action "com.thenewboston.travis.SPLASH" would see your activity
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.SPLASH" /> //try "android.intent.action.MAIN" here//
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources