Android ClassNotFoundException

筅森魡賤 提交于 2019-11-26 20:52:21

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).

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...

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

Dalmas

I was already discussing this problem here : Android: Unable to instantiate activity / ClassNotFoundException but we couldn't find a definite answer... However John J Smith's answer about the right use of Context is interesting.

Some people also resolved their problem on this thread and gives some ideas.

Hope this helps...

(By the way I'm happy to see another Go game programmer !)

Kiran

I added a custom layout and started seeing ClassNotFoundException messages after only on the signed application package but the development build was working just fine. I was using ProGuard and the new layout I added was not included in the "exclude" list in the ProGuard config. I included the custom layout in ProGuard exclude list and that fixed the issue for me.

I encounter this problem sometimes when developing- ususally after changing package names. A quick clean of the project fixes the issue for me.

There's another thing that causes "ClassNotFoundException". Some time ago, the android project started using the libs directory for dependencies. If a jar is in the libs directory, it's on the classpath automatically so you don't have to add it in the project settings. However, jars in "libs" can't have sources attached (which is ridiculous). So if you want to attach a source, you move a jar from "libs" to "lib" and you add it to the classpath. You can attach the source. But I've seen several times that this triggers ClassNotFoundExceptions on my classes. Moving the jar back solves the problem.

I had the same issue. In the end the problem was just missing tabulations in the layout xml.

Before:

    <org.osmdroid.views.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent" 
    android:layout_height="0dip"
    tilesource="MapquestOSM" 
    android:layout_weight="1"
    />

Then with indentation the classNotFoundException never apeared again, and the map showed properly:

    <org.osmdroid.views.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent" 
        android:layout_height="0dip"
        tilesource="MapquestOSM" 
        android:layout_weight="1"
    />

My experience may be that the android sdk was updated and the link to the support library needed to be refreshed. Just go to project settings > android and point to the support library again.

For me the Problem was one little Caps-Fault. I looked up my code for hours where everything was all right. Some time I looked into my .xml-Files then - and there it was:

In the java-Files I used a ViewPager and in one nasty little piece of the xml I lost my caps and typed viewPager by mistake. Obvious, that this one was not able to be found...

this is due to the new version of eclipse ... remove all external dependencies from buildpath and add it again using project->properties->builspath->libraries tab. Now add back all dependency library and select all the components by clicking against them on order and project tab on project->properties->builspath- . this will work fine !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!