Android的ClassNotFoundException的 [英] Android ClassNotFoundException

查看:192
本文介绍了Android的ClassNotFoundException的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我的应用程序之一,我想知道如果任何人都可以给我任何洞察可能导致它。

I am having a problem with one of my apps and I was wondering if anyone could give me any insight into what maybe causing it.

我得到一个 ClassNotFoundException的,下方重要行是

I am getting a ClassNotFoundException, the important line below is

E/AndroidRuntime(21982): Caused by: java.lang.ClassNotFoundException: couk.doridori.goigo.customUI.GoBoardView in loader dalvik.system.PathClassLoader@446fc3d0

现在这个程序已经出了一年零2天前,我​​有两个单独的用户与我联系,就这个问题,一个是关于一个HTC野火(2.1)和一个三星Galaxy S(?)。现在,我不能重新在我的设备(2.2和1.6)或仿真器(2.1)这个问题,并不能真正明白为什么这个类不能被类加载器中找到。我已经用了,而谷歌搜索无果,希望有人有一些指点!它只是似乎是当一个活动被装入其中当内容查看设置,它试图膨胀的自定义视图名为 GoBoardView 扩展了视图类,这只是做一些简单的帆布绘画和不使用任何第三方库或其他任何类,将有一个包名冲突或任何东西。

Now this app has been out for over a year and 2 days ago I had two seperate users contact me regarding this issue, one on a HTC wildfire (2.1) and one a Samsung Galaxy S (?). Now I cannot recreate this problem on my devices (2.2 and 1.6) or an emulator (2.1) and cannot really work out why this class cannot be found by the classloader. I have spent a while googling to no avail, and hopes someone has some pointers! It only seems to be when an activity is loaded which when the contentView is set, it tries to inflate a custom View called GoBoardView which extends the View class, this is just doing some simple canvas drawing and is not using any third party libs or any other classes that would have a packagename clash or anything.

请帮忙!以防万一的构建问题,我通过月食更新所有我的SDK和ADT因为它是建立针对1.6和使用旧的ADT,但我不知道这是否会帮助只是觉得值得一试。任何意见将是巨大的感谢! (参见下面的编辑)

Please help! Just in case its a build issue I am updating all my SDK and ADT through eclipse as it was building against 1.6 and using the old ADT, but I have no idea if this will help just thought worth a try. Any advice would be great thanks! (see below for EDIT)

E/AndroidRuntime(21982): java.lang.RuntimeException: Unable to start activity ComponentInfo{couk.doridori.goigoFull/couk.doridori.goigoFull.Board}: android.view.InflateException: Binary XML file line #14: Error inflating class couk.doridori.goigo.customUI.GoBoardView
E/AndroidRuntime(21982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
E/AndroidRuntime(21982): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
E/AndroidRuntime(21982): at android.app.ActivityThread.access$2200(ActivityThread.java:126)
E/AndroidRuntime(21982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
E/AndroidRuntime(21982): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(21982): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(21982): at android.app.ActivityThread.main(ActivityThread.java:4603)
E/AndroidRuntime(21982): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(21982): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(21982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(21982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(21982): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(21982): Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class couk.doridori.goigo.customUI.GoBoardView
E/AndroidRuntime(21982): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
E/AndroidRuntime(21982): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
E/AndroidRuntime(21982): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
E/AndroidRuntime(21982): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
E/AndroidRuntime(21982): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
E/AndroidRuntime(21982): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime(21982): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime(21982): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
E/AndroidRuntime(21982): at android.app.Activity.setContentView(Activity.java:1629)
E/AndroidRuntime(21982): at couk.doridori.goigoFull.Board.onCreate(Board.java:31)
E/AndroidRuntime(21982): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(21982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
E/AndroidRuntime(21982): ... 11 more
E/AndroidRuntime(21982): Caused by: java.lang.ClassNotFoundException: couk.doridori.goigo.customUI.GoBoardView in loader dalvik.system.PathClassLoader@446fc3d0
E/AndroidRuntime(21982): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime(21982): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime(21982): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime(21982): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
E/AndroidRuntime(21982): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
E/AndroidRuntime(21982): ... 22 more

修改

好吧,研究一些用户有评论在回答这个问题的环节,似乎使用了错误的上下文的装载活动可能导致此问题。我发现这个有趣的监守一个两个日志报告我已经发送了由

Ok, researching some of the links that users to have commented in reply to this question, it seems that the use of the wrong context for loading activities can cause this problem. I find this interesting becuase one of the two log reports i have been send has this exception preceeded by

W/ActivityManager( 1222): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { flg=0x20000 cmp=couk.doridori.goigoFull/.Games }

这是相当自我解释 - 问题是我不知道从哪里这种活动可以被从它使用的是非活动背景下启动的,所以我是一个有点难倒,认为它马爷有一些多任务像怪癖和它被带回成某事的前景。那么这显然可以导致问题的类加载器。如果这是发生在用户的手机,我看不出为什么我不能重现此(和大多数其他用户无法要么)。

which is quite self explanatory - problem is i have no idea where this activity could be being started from where it uses a non activity context, so im a bit stumped, thinking it maye be some multitasking like quirk and its being brought back into the foreground of something . This can then apparently cause problems with the classLoader. If this was happening on a users phone i cant see why i cannot reproduce this (and most other users cannot either).

另外我通过有趣的链接发现,一些人都遇到过的问题由于不正确的apk安装,可通过重新安装来解决,我也问过谁有问题的用户尝试(不有所作为)。此外,它似乎一旦遇到问题(这是在首次使用时),这将是持久的。

The other thing i found through the links which is interesting, is some people have encountered problems due to a "incorrect apk installation', which can be resolved by a reinstall, which i have asked the users who have had the problem to try (which does not make a difference). Also it seems once the problem is encountered (which is on first use) it will be persistent.

推荐答案

我不能不注意到你的活动名称为 couk.doridori.goigoFull.Board 但丢失的自定义视图类 couk.doridori.goigo.customUI.GoBoardView ...它看起来像你可能有两种不同的封装(goigo VS goigoFull)。

I can't help but notice that your Activity name is couk.doridori.goigoFull.Board but your missing custom View class is couk.doridori.goigo.customUI.GoBoardView ... it looks like you might have two different packages (goigo vs goigoFull).

您的任何机会做聪明的事情与库项目?你要非常小心,在code和布局XML ...

Are you by any chance doing clever things with library projects? You'll want to be really careful with fully-qualified classnames in code and in layout xml...

(如果没有,请添加有关项目的设置更多信息,并粘贴您的布局XML其中layoutinflater被窒息)

(If not please add some more information about your project setup and also paste your layout XML which the layoutinflater is choking on)

这篇关于Android的ClassNotFoundException的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆