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.
Related
I'm trying to build an android game with Unity 2019.2, using IL2CPP background and Android App Bundle format.
Whenever I try to launch the game, it crashes right after the Unity splash screen.
It actually crashes when loading a scene asynchronously, I have a first scene for loading purpose, so when the game starts, this first scene opens up and load the actual game scenes in background.
I don't know if this has anything to do with my problem, but I'm using Google Play Services 0.9.64 (which is the latest right now).
I can really list everything I tried, because I had this problem for quite some time.
Right now I'm using Unity 2019.2.0f1, but the first time I had this problem was with 2019.1.10f1 and I tried with many versions, nothing seems to work there.
I checked if there was any problem with the AndroidManifest file but I don't see anything wrong.
I tried to remove the OpenGLES3 option from Player Settings > Other > Graphics APIs (it seems to be a problem for some people).
[EDIT] I tried to add permissions lines in the Android Manifest file for Internet Access (and did the same thing for this options in Unity's Player Settings).
If that might help, here's what my Android Manifest looks like:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application>
<!-- The space in these forces it to be interpreted as a string vs. int -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="\u003████████████" />
<!-- Keep track of which plugin is being used -->
<meta-data android:name="com.google.android.gms.games.unityVersion"
android:value="\u0030.9.64" />
<activity android:name="com.google.games.bridge.NativeBridgeActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>
(I prefer to hide the APP_ID value, in case that might cause security issue)
And here's the LogCat errors:
E/ActivityTrigger(2337): activityStartTrigger: not whiteListed com.████████████.████████████/com.unity3d.player.UnityPlayerActivity/41
E/ActivityTrigger(2337): activityResumeTrigger: not whiteListed com.████████████.████████████/com.unity3d.player.UnityPlayerActivity/41
E/ActivityTrigger(2337): activityResumeTrigger: not whiteListed com.████████████.████████████/com.unity3d.player.UnityPlayerActivity/41
E/InputDispatcher(2337): channel '3ea1bfc com.████████████.████████████/com.unity3d.player.UnityPlayerActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I don't know what that means and I did quite a lot of research about the "activityStartTrigger: not whiteListed" thing, but can't seem to find anything online.
Also I'm not doing anything in my code with UnityPlayerActivity.
It would be amazing if anyone could help me, I'm stuck on this problem and it prevent me from releasing my game.
Thanks a lot for your attention.
Ok so...
After A LOT of troubleshooting, I finally found the reason of these crashes, and how to fix them.
The logs I attached to the main message are actually incomplete.
I got these from Android Device Monitor's logcat, with the filter "Unity", but there's many more Unity related logs that weren't showing.
The activityStartTrigger thing is actually there on most of my builds, and is not responsible for any crashes.
The interesting one was about memory leaks:
Could not allocate memory: System out of memory!
So now, to know where that things was happening, I went back to previous git commits, to find from where the builds were crashing.
Long story short:
I had several serialized variables that I were using in the Editor only (I do a lot of Editor scripting), and since I didn't need these variable in my builds, I wrapped them in #if UNITY_EDITOR #endif instructions.
But they were still serialized, so the serialize model of my objects wasn't the same as the actual objects inside my builds.
I guess this got the memory all messy and eventually crashed my game.
So in the end, I gotta serialize all these variables, even though I'm not using them. This isn't so much data that my games will become slow or whatever, but its kinda annoying, so I'll probably find some workaround for these unused variables.
I hope this feedback can help anyone.
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>
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 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