ma1co / OpenMemories-Framework

Build Android apps for your favorite Sony camera
MIT License
236 stars 35 forks source link

Not able to use stubs in Emulator: NoClassDefFoundError #1

Closed mattijsf closed 8 years ago

mattijsf commented 8 years ago

I'm not sure if there are already stubs available but as a test I tried to create a new instance of DisplayManager on the emulator. But got a NoClassDefFoundError.

This is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0 rc2"

    defaultConfig {
        applicationId "com.example.mattijs.ftpsync"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

    compile 'com.github.ma1co.OpenMemories-Framework:framework:-SNAPSHOT'
    provided 'com.github.ma1co.OpenMemories-Framework:stubs:-SNAPSHOT'
}

Once I run the app in the emulator I get these stracktraces:

04-03 13:47:21.560 2294-2294/com.example.mattijs.ftpsync D/dalvikvm: Not late-enabling CheckJNI (already on)
04-03 13:47:21.570 2294-2294/com.example.mattijs.ftpsync E/Trace: error opening trace file: No such file or directory (2)
04-03 13:47:21.649 2294-2294/com.example.mattijs.ftpsync D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
04-03 13:47:21.649 2294-2294/com.example.mattijs.ftpsync D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-03 13:47:21.649 2294-2294/com.example.mattijs.ftpsync D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so

                                                                   [ 04-03 13:47:21.649  2294: 2294 D/         ]
                                                                   HostConnection::get() New Host Connection established 0xb982d2b0, tid 2294
04-03 13:47:21.699 2294-2294/com.example.mattijs.ftpsync W/EGL_emulation: eglSurfaceAttrib not implemented
04-03 13:47:21.699 2294-2294/com.example.mattijs.ftpsync D/OpenGLRenderer: Enabling debug mode 0
04-03 14:00:45.671 17065-17065/com.example.mattijs.ftpsync E/Trace: error opening trace file: No such file or directory (2)
04-03 14:00:45.682 17065-17065/com.example.mattijs.ftpsync I/dalvikvm: Could not find method com.sony.scalar.provider.AvindexStore$Images$Media.getContentUri, referenced from method com.example.mattijs.ftpsync.MainActivity.onCreate
04-03 14:00:45.682 17065-17065/com.example.mattijs.ftpsync W/dalvikvm: VFY: unable to resolve static method 60: Lcom/sony/scalar/provider/AvindexStore$Images$Media;.getContentUri (Ljava/lang/String;)Landroid/net/Uri;
04-03 14:00:45.682 17065-17065/com.example.mattijs.ftpsync D/dalvikvm: VFY: replacing opcode 0x71 at 0x000b
04-03 14:00:45.712 17065-17065/com.example.mattijs.ftpsync D/AndroidRuntime: Shutting down VM
04-03 14:00:45.712 17065-17065/com.example.mattijs.ftpsync W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb4f6f288)
04-03 14:00:45.712 17065-17065/com.example.mattijs.ftpsync E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             java.lang.NoClassDefFoundError: com.sony.scalar.provider.AvindexStore$Images$Media
                                                                                 at com.example.mattijs.ftpsync.MainActivity.onCreate(MainActivity.java:17)
                                                                                 at android.app.Activity.performCreate(Activity.java:5008)
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                 at android.os.Looper.loop(Looper.java:137)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                                                 at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                 at java.lang.reflect.Method.invoke(Method.java:511)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                                 at dalvik.system.NativeStart.main(Native Method)
04-03 14:05:58.726 22862-22862/com.example.mattijs.ftpsync D/dalvikvm: DexOpt: unable to opt direct call 0x003a at 0x0a in Lcom/example/mattijs/ftpsync/MainActivity;.onCreate
04-03 14:05:58.736 22862-22862/com.example.mattijs.ftpsync D/AndroidRuntime: Shutting down VM
04-03 14:05:58.736 22862-22862/com.example.mattijs.ftpsync W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb4f6f288)
04-03 14:05:58.736 22862-22862/com.example.mattijs.ftpsync E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             java.lang.NoClassDefFoundError: com.sony.scalar.hardware.avio.DisplayManager
                                                                                 at com.example.mattijs.ftpsync.MainActivity.onCreate(MainActivity.java:15)
                                                                                 at android.app.Activity.performCreate(Activity.java:5008)
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                                                                                 at android.app.ActivityThread.access$600(ActivityThread.java:130)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                 at android.os.Looper.loop(Looper.java:137)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                                                 at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                 at java.lang.reflect.Method.invoke(Method.java:511)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                                 at dalvik.system.NativeStart.main(Native Method)
ma1co commented 8 years ago

This won't fix. The stubs are just declarations to allow you to use the APIs of your camera. These classes aren't available in the emulator however. That's why I'm building the framework around it which contains an alternative implementation for normal android devices. Until that's finished, you'll have to ditch the emulator and test everything on your camera.

mattijsf commented 8 years ago

Debugging / testing in emulator would be pretty much vital for development. I'll work around the limitation using interfaces / proxies for now where possible. Thanks for clarifying.