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
Related
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>
I created an Andriod app for a Chinese Newspaper Company.
From the Exception/ANR report of Google Play Store, it was found that some users encountered the problem of ClassNotFoundException when they launch the app.
The app cannot found the activity marked as
<category android:name="android.intent.category.LAUNCHER" />
The frequency is about every 3 sessions out of 500000.
What are the possibilities leading to ClassNotFoundException?
Remakrs:
I doubt if this related to the package name.
In the first few lines of AndroidManifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.news"
the source code are stored in different folder name (Real file storage place)
com.anotherCompany.abc
so.. in the activity tag (AndroidManifest)
<activity
android:name="com.anotherCompany.abc.MainActivity"
android:label="#string/app_name"
Thank you for your time
If this happens rarely, I think you shouldn't worry too much about it.
It can be due to a bad installation, a bad phone backup, or some android mods. But probably not something related to your code.
Hi all. This is my first post on StackOverflow, though I have been making use of this site for a several years. Usually I'm able to find an answer to any queries that I may have, by referring to questions that others have asked; however, in this case I am completely stumped, despite having done quite a bit of homework already
I am currently in the process of developing an Android application which is required to communicate with a piece of hardware - more specifically a PIC32 board - and display data that is returned by the board in real-time.
At present I have simply been using Eclipse and Android emulator for designing the interface and programming the backend of the application. And, I have now gotten to a stage where I would like to test the operation of the application on a physical Android device. However, whenever I attempt to install the application, directly from the phone (I send the .apk via Dropbox) I always get the error 'The application Package installer (process com.android.packageinstaller) has stopped unexpectedly. Please try again'. Now, I have done my homework and seemed to have determined that the error may lie in the Android Manifest file for the application. However, I just cannot see where this issue may be. I have seen other issues resolved by removing certain tags or replicated tags; however, even then my application does not want to install on my device, though it installs and works pretty much perfectly everytime when run through the emulator.
The application I am developing is based loosely on the Demo code provided by the hardware manufacturer. It has been appropriately modified. And, when I appropriately modified the Manifest file for my application and tested it with the demo application everything seemed to work fine on a physical device. So, something is telling me that the Manifest file may not actually be the issue. The key differences between my application and the demo application is that I have divided the code up into appropriate packages, such that one contains application code (activities) and the other contains code for communicating with the PIC32 board. I have also added an activity - the demo code only has one, but have two at present. The final difference is that I have defined a global object, for communicating with the board, that can be used by all of the application's activities. However, I don't believe that these would be the cause of this issue.
So again, the application seems to work fine on the emulator, but it simply does not want to install on a physical Android device - everytime I try to install I get an alert dialog box displaying this message.
I would very much appreciate any help and advice that anybody could provide, and thanks in advance.
Also, here is the Manifest file for the application I am developing:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tribosonics.android.TribosonicsApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" >
</uses-sdk>
<uses-sdk android:targetSdkVersion="10" >
</uses-sdk>
<!--
<permissions>
<feature name="android.hardware.usb.accessory" />
<library
name="com.android.future.usb.accessory"
file="/system/framework/com.android.future.usb.accessory.jar" />
</permissions>
-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".GlobalAccessoryManager"
android:debuggable="true"
android:icon="#drawable/tribosonics_icon"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
<activity
android:name=".TribosonicsApp"
android:label="#string/app_name"
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=".SetScanPreferences"
android:screenOrientation="portrait" >
</activity>
<uses-library android:name="com.android.future.usb.accessory" />
</application>
</manifest>
android manifest, icon image is big so please reduce your image icon size and run the application it's working fine.
I saw this with the following exception in LogCat:
E/AndroidRuntime(28817): FATAL EXCEPTION: main
E/AndroidRuntime(28817): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.example.app/.MyActivity } from ProcessRecord{487978e8 28817:com.android.packageinstaller/10063} (pid=28817, uid=10063) requires android.permission.ACCESS_FINE_LOCATION
I thought the problem was due to some <uses-permission...> tags in the manifest but in my case there was an android:permission="..." attribute in my manifests application tag which seemed to be causing the package manager to get the exception and barff. Deleting this got me going again.
change changing android:debuggable="true" to android:debuggable="false" and see if it makes any difference.
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.
I keep getting this weird error message every time I'm testing my app on the Android emulator. It pops up every few seconds non-stop and constantly interrupts me. It's really annoying and I have no clue how to get rid of it, or what it even says. I guess it's in German but I tried translating it using Google, and made no sense of the body, only the title which barely made any sense.
Does someone know how to fix this problem?
Link to image: http://oi54.tinypic.com/v4bcqv.jpg
I'm a new user so I can't post images
*EDIT: I tried uninstalling all the applications I created from the emulator. The message is still there. Below is my manifest file (which someone said might be the cause of the problem): *
<application android:icon="#drawable/icon" android:label="#string/app_name" android:debuggable="true" android:enabled="true">
<activity android:name=".QuizSplashActivity"
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="QuizGameActivity"></activity>
<activity android:name="QuizHelpActivity"></activity>
<activity android:name="QuizMenuActivity"></activity>
<activity android:name="QuizScoresActivity"></activity>
<activity android:name="QuizSettingsActivity"></activity>
</application>
PROBLEM FIXED: apparently all I had to do was replace the AVD with a new one
hey,
this is dutch and not german language. i also typed it in the google translator and thats what came out:
"Care, because the application component is enabled. malicious applications can use this to key phone functions off. an authorization must be carefully considered, since application components unusable, inconsistent, or could become unstable."
guess that can be caused by a missing entrance in the manifest file or something like that.
hope the better translation can help you a bit.
That is extremely weird, I've never seen anything like that before. Few questions to try and help you troubleshoot:
Does this happen with only one of your applications?
Are you using any third-party libraries?
When you try to run the application from a different computer, do you have this problem?
Is this only on the emulator or when you try to run it on your phone too?