Skip to content

java.lang.NoClassDefFoundError: org.phoenixframework.channels.Socket$PhoenixWSListener #55

Description

@Parsoa

I don't if this is really an issue with the library or a mistake on my end so I post here anyway.

This is my build configuration:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.sandzar.paywand"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    productFlavors {
        demo {
            applicationId "com.sandzar.paywand"
            buildConfigField "boolean", "IS_DEMO", "true"
        }
    }
}

repositories {
    mavenCentral()
    maven {
        url 'https://raw.github.com/iainconnor/ObjectCache/master/maven/'
    }
}

def dbflow_version = "4.0.5"
def sqlcipher_version = "3.5.7"

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${dbflow_version}"
    compile "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'

    compile 'com.fasterxml.jackson.core:jackson-databind:2.8.3'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.8.0'
    compile 'com.google.code.gson:gson:2.8.0'

    compile('com.github.eoinsha:JavaPhoenixChannels:0.2') {
        exclude module: 'groovy-all'
        exclude module: 'okhttp-ws'
        exclude module: 'jackson-databind'
    }
}

I get the following error as soon as any socket methods are invoked:

java.lang.NoClassDefFoundError: org.phoenixframework.channels.Socket$PhoenixWSListener E at org.phoenixframework.channels.Socket.<init>(Socket.java:167) E at org.phoenixframework.channels.Socket.<init>(Socket.java:170) E at com.sandzar.paywand.sockets.SocketService.initiateSocketConnection(SocketService.java:66) E at com.sandzar.paywand.sockets.SocketService.onStartCommand(SocketService.java:50) E at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3010) E at android.app.ActivityThread.access$2200(ActivityThread.java:150) E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442) E at android.os.Handler.dispatchMessage(Handler.java:102) E at android.os.Looper.loop(Looper.java:148) E at android.app.ActivityThread.main(ActivityThread.java:5417) E at java.lang.reflect.Method.invoke(Native Method) E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764) E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) Process I Sending signal. PID: 4379 SIG: 9

The is the portion of code that causes the error:

private void initiateSocketConnection() {
    try {
        Log.e(DEBUG_TAG, "initiateSocketConnection") ;
        socket = new Socket(Constants.CHANNEL_URL);
        socket.onOpen(new ISocketOpenCallback() {
            @Override
            public void onOpen() {
                try {
                    final ObjectNode payload = objectMapper.createObjectNode();
                    payload.put("token", UserRepository.getInstance().getLoggedInUser().getAuthenticationToken()) ;
                    channel = socket.chan(getUserChannelTopic(), payload);
                    channel.join().receive("ok", new IMessageCallback() {
                        @Override
                        public void onMessage(final Envelope envelope) {
                            Log.e(DEBUG_TAG, "Joined channel successfully") ;
                        }
                    });
                    channel.on("payment:new", new IMessageCallback() {
                        @Override
                        public void onMessage(Envelope envelope) {

                        }
                    }) ;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
        socket.onClose(new ISocketCloseCallback() {
            @Override
            public void onClose() {

            }
        });
        socket.onError(new IErrorCallback() {
            @Override
            public void onError(String s) {

            }
        });
    } catch(Exception e) {
        e.printStackTrace() ;
    }
}

Here is some extra output from the console:

Java7Support  W  Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
 art  I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListener>
      I  Rejecting re-init on previously-failed class java.lang.Class<org.phoenixframework.channels.Socket$PhoenixWSListen

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions