Android 应用程序无法在 PathClassLoader 中的某些手机上加载
我有一个应用程序,我们将其称为“com.company.foo”,其主要活动为“FooBar”。在我的 AndroidManifest.xml 中,我有
<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>
(其中点包含我的应用程序内的其他活动)。在这种形式下,它可以很好地满足我的 HTC 需求和模拟器。然而,极少数从市场下载该应用程序的人报告崩溃
java.lang.RuntimeException:无法实例化活动 ComponentInfo{com.company.foo/com.company.foo.FooBar}:java.lang.ClassNotFoundException:加载器 dalvik.system.PathClassLoader 中的 com.company.foo.FooBar [/mnt/asec/com.company.foo-1/pkg.apk]
有人建议将 android:name="FooBar"
替换为 android:name=".FooBar"
,它在我的手机和模拟器上再次运行良好,但在其他一些设备上失败。如果我完全忽略这个属性,它根本不会让我安装。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Android Market 上发布了一个应用程序。有时我会收到类似的崩溃报告。看来这不是你的错。如果您的应用程序安装在 SD 卡上,则可以复制此内容。弹出此卡而不卸载它并运行您的应用程序。
如需了解更多信息,请访问此处。
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.
您显示的代码很好,看不出有什么问题 - 那么您还看了什么?
您是否针对失败的手机上的 Android 版本检查了 SDK 级别?是否有可能存在不兼容的情况?
实例化我发现的活动并不是一件小事,而且有很多事情会出错 - 您将必须回顾所有支持文件并确保它们是干净的,但要考虑不兼容性.
您还没有说涉及哪些导入 - 您是否尝试过将您的应用程序削减到最低限度,看看它是否仍然会导致那些少量的流氓手机出现问题 - 也许您无权访问这些手机?
尝试发布导致问题的手机品牌/型号,以及在哪里访问您的应用程序,这里可能有人拥有相同的品牌/型号,愿意为您做一些测试
抱歉,我无法提供更多帮助,
祝您好运!!
奥利弗
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