Android Studio Installs Multiple Versions of the App (Debugging) - android

When I am debugging my Android App, I see multiple apps of it installed on my device, each one seems to be of an holder version. This is really annoying because most are bugged and crash on launch. Anyway I can have Android studio just install the current version.
I've tried to uninstall all the app (uninstalling one uninstalls them all) and re-launching it and It adds them back. I am debugging, not building APK's.
Thank you.

Try deleting the old not working project folders.

Are you accidentally building and deploying multiple flavours? How does your modules .gradle file look like?
Edit: you might want to check this: https://stackoverflow.com/a/27633032/3540885 (Have you set up more than one activity to be launched at start?)

I believe there could be various reasons for multiple installation of app during debug. I also faced similar issue once for one of my app and I after a thorough analysis I found AndroidManifest.xml was the culprit, though it was my mistake as at some point while adding and testing multiple activities I defined two of the activities as launcher activities and hence it was creating two instances of the app when I was debugging.
Check if in your case too, you have defined multiple activities as launcher activities.
Following code part should only exist for your actual launcher activity which you want to launch when you app starts.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Related

Duplicate app logo when downloading Android App

Whenever I run an Android app from eclipse and downloaded into a phone,there will be a duplication of the application I downloaded. For instance my app is called "MyAndroidApp" and when I run it into my phone, there is two application of "MyAndroidApp". Does anyone know why?
Look at your manifest, you must have two
<category android:name="android.intent.category.LAUNCHER" />
declared

every class of application installing individually in the phone.

I developed an android application with no errors. It is installed in my phone and functioning perfectly but the only problem is, when I'm installing the application. It is installing all the classes in application individually and along with it my main application.
So, how should I prevent all the classes installing individually. please help me.
I am guessing that your AndroidManifest.xml has multiples of this:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Which is causing multiple icons to be showed for each Activity
Find all the "extra" ones and delete them. This used to be an issue with the ADT plugin a while back (every time you made a new Activity via the wizard, it would auto add it with launcher attributes), you seem to be on an older version. You should update it.

Eclipse loads separate activities instead of application

I'm using Eclipse and android SDK (with ADT Plugin), I don't know if it's some kind of configuration issue or it's some code problem. Whenever I load an app that I made from scratch (this means not using another existing code or one sample from the library) to my device or run it on the emulator, the entire app will load as "separate" apps, which are the activities. For example, if the app is named "Hello world" and it has two activities, "MainActivity" and "SecondaryActivity", both of them will show up on the device with their names as app names and sharing the app icon on the menu. Now, if I go to settings, "Hello World" appears as an application, now behaving again like it should. This doesn't affect the operation of the app, however, it's annoying to have more than 1 icon launching the same app. The problem is that, when i first used eclipse, this was not happening.
Just in case it helps, I've already re-installed the entire android SDK and the ADT plugin, as well, I tried using 3 different Eclipse versions (classic, EE, and Java developers), none of them seem to work, even though, in the Graphical Layout for any activity, the name of the app is showed in the bar with the app's icon, but running on the emulator or a real device it shows the activity's name there instead. I've looked everywhere and I haven't solved the problem.
Thanks!
Check your manifest to see if more than one activity has this:
<category android:name="android.intent.category.LAUNCHER" />
The answer I found for the above problem is, replace category.LAUNCHER to category.EMBED in all the activities apart from the MainActivity in your manifest file.

.apk installed on Android but cannot be found anywhere!

I have developed two small applications for Android using Eclipse. Then i ran them both on the phone by right-clicking on the project and "run as android application", and they were successfully tested. However, when i try to install their .apk files, one of them appears in the list, while the other does not appear. I checked the application manager and it shows that the application is saved.
I tried to find it using the "search" in the phone, it can find all saved .apk except this one.
Pls do you have any idea where did i go wrong especially that it seems saved, and only this application does not appear in the phone although the application manager says it is installed.
Found out why this was happening. You need this in your AndroidManifest as a part of your main activity.
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
My mistake was that I used <action android:name="android.intent.category.LAUNCHER"/> instead of <category android:name="android.intent.category.LAUNCHER"/>. Without the category.LAUNCHER, you're not telling it to list the software in the application launcher, so it becomes invisible.
You may need to enable third party apps on your phone since it is not able to find the one you created.
(Applications >> Enable Unknown sources)
Also you may want to use an APK installer(search) App like App Installer to easily find your own APKs and install them.
And as always uninstall and give it another go, as mentioned above it has happened to everyone it seems.
Your way of description is quiet messy. By phone do you mean the emulator? If it cannot find the .apk and it doesn't appear in the project folder, then clean the project (Project menu) or restart Eclipse. This usually solves the problem. Idk why this is happening so often.

Android app fails to load on some phones in PathClassLoader

I have an app, let us call it 'com.company.foo', with a main Activity 'FooBar'. In my AndroidManifest.xml, I have
<application android:label="#string/app_name"
android:icon="#drawable/icon"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<activity android:name="FooBar"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
(where the dots contain other activities inside my app). In this form, it works fine on my HTC desire and on the emulator. However, a (very) small number of people who downloaded the app from the market report a crash with
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.company.foo/com.company.foo.FooBar}: java.lang.ClassNotFoundException: com.company.foo.FooBar in loader dalvik.system.PathClassLoader[/mnt/asec/com.company.foo-1/pkg.apk]
Someone suggested to replace the android:name="FooBar" with android:name=".FooBar", which again works fine on my phone and the emulator, but fails on some other devices. If I leave this attribute out altogether it will not let me install at all.
Any ideas?
I have an app published on Android Market. And sometimes I receive similar crash reports. Seems that's not your fault. This can be reproduced if your app is installed on SD card. Eject this card without unmounting it and run your app.
Additional information can be found here.
The code that you have shown is fine, can't see anything wrong with it - so what else have you looked at?
Have you checked the SDK level against the android release on teh phones that have failed? Any chance of some incompatability there?
Instantiating the activity I have found to my cost is a non-trivial matter and there are so many things to go wrong - you will have to go back over all your support files and make sure that they are clean but think about incompatabilities.
You have not said what imports are involved - have you tried cutting down your app to the bare minimum and see does it still cause problems with those small number of rogue phone - maybe you dont have access to the phones?
Try posting the phone makes/models that are causing problems, also where to access your app and there might be someone out here with the same make/model who would be willing to do some testing for you
Sorry I can't be more help,
Good Luck!!
Oliver

Categories

Resources