Skip to content Skip to sidebar Skip to footer

NoClassDefFound Error: Logcat Reads $1 Indicating Error On Inner Class But I Have None

I am setting up a tcp server in android and I am able to get the sample working but not implementing the sample on to my own app. I keep getting a NoClassDefFound error and have tr

Solution 1:

I'm unsure about the error, but $1 refers to an anonymous inner class (a class with no name) like the one you use here

private void onResponseReceived(Object sender,
        final TypedResponseReceivedEventArgs<MyResponse> e) {
    // Display the result - returned number of characters.
    // Note: Marshal displaying to the correct UI thread.
    myRefresh.post(new Runnable() {
        public void run() {
            myResponseEditText.setText(Integer.toString(e
                    .getResponseMessage().Length));
        }
    });
}

Technically you are creating a subclass of Runnable that is called $1 and is inner to this class. Not sure what the error is though I would try recompiling everything


Solution 2:

You haven't recompiled everything. Either that or you've got a wayward entry in your classpath.


Solution 3:

I think i figured out the problem,

In the manifest file the package is declared for the AndroidNetCommunicationClientActivityInner as

package="com.example.com.proto1"

But actually you are not having that class in that package, instead in the default package since there is no package declaration in the specified JAVA file.

But android looks for that package for that class, therefore throws java.lang.NoClassDefFoundError.


Post a Comment for "NoClassDefFound Error: Logcat Reads $1 Indicating Error On Inner Class But I Have None"