Libgdx: Error en la ejecución de generate jar con dependencias gdx-backend-lwjgl3 y gdx-tools

Creado en 11 jun. 2017  ·  3Comentarios  ·  Fuente: libgdx/libgdx

Detalles del problema

Cuando genero un jar desde un projet gdx con dependencias gdx-backend-lwjgl3 y gdx-tools e intento ejecutar este jar, tengo un error. La aplicación gdx se ejecuta perfectamente con la misma configuración cuando uso Gradle para ejecutar esto.

Pasos de reproducción / código

  1. Cree un nuevo proyecto gdx con la aplicación de configuración solo para escritorio
  2. Migrar a gdx-backend-lwjgl3
  3. Agregar dependencia de gdx-tools en el módulo de escritorio
  4. Haz un ./gradlew clean dist
  5. Haz un java -jar desktop/build/libs/desktop-1.0.jar

Versión de LibGDX y / o dependencias relevantes

1.9.6 con dependencias gdx-backend-lwjgl3 y gdx-tools

Stacktrace

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/lwjgl/system/Callback.<clinit>()V <strong i="19">@136</strong>: invokestatic
  Reason:
    Type 'org/lwjgl/PointerBuffer' (current frame, stack[1]) is not assignable to 'org/lwjgl/system/CustomBuffer'
  Current Frame:
    bci: <strong i="20">@136</strong>
    flags: { }
    locals: { 'org/lwjgl/system/MemoryStack', null, '[Ljava/lang/Class;', '[Ljava/lang/reflect/Method;', 'org/lwjgl/PointerBuffer' }
    stack: { '[Ljava/lang/reflect/Method;', 'org/lwjgl/PointerBuffer' }
  Bytecode:
    0x0000000: b800 364b 014c 04bd 0037 5903 b200 3853
    0x0000010: 4d10 09bd 0039 5903 123a 123b 2cb6 003c
    0x0000020: 5359 0412 3d12 3b2c b600 3c53 5905 123e
    0x0000030: 123b 2cb6 003c 5359 0612 3f12 3b2c b600
    0x0000040: 3c53 5907 1240 123b 2cb6 003c 5359 0812
    0x0000050: 4112 3b2c b600 3c53 5910 0612 4212 3b2c
    0x0000060: b600 3c53 5910 0712 4312 3b2c b600 3c53
    0x0000070: 5910 0812 4412 3b2c b600 3c53 4e2a 2dbe
    0x0000080: b600 453a 042d 1904 b800 46b8 0047 5819
    0x0000090: 04b6 0048 b300 1e19 04b6 0048 b300 1f19
    0x00000a0: 04b6 0048 b300 2019 04b6 0048 b300 2119
    0x00000b0: 04b6 0048 b300 2219 04b6 0048 b300 2319
    0x00000c0: 04b6 0048 b300 2519 04b6 0048 b300 2619
    0x00000d0: 04b6 0048 b300 242a c600 462b c600 132a
    0x00000e0: b600 49a7 003b 4d2b 2cb6 004b a700 322a
    0x00000f0: b600 49a7 002b 4d2c 4c2c bf3a 052a c600
    0x0000100: 1d2b c600 152a b600 49a7 0012 3a06 2b19
    0x0000110: 06b6 004b a700 072a b600 4919 05bf a700
    0x0000120: 0f4b bb00 1459 124d 2ab7 004e bfb8 004f
    0x0000130: 57b1                                   
  Exception Handler Table:
    bci [223, 227] => handler: 230
    bci [6, 215] => handler: 246
    bci [6, 215] => handler: 251
    bci [261, 265] => handler: 268
    bci [246, 253] => handler: 251
    bci [0, 286] => handler: 289
  Stackmap Table:
    full_frame(<strong i="21">@230</strong>,{Object[#149],Object[#150]},{Object[#150]})
    same_frame(@239)
    same_locals_1_stack_item_frame(<strong i="22">@246</strong>,Object[#150])
    same_locals_1_stack_item_frame(<strong i="23">@251</strong>,Object[#150])
    full_frame(<strong i="24">@268</strong>,{Object[#149],Object[#150],Top,Top,Top,Object[#150]},{Object[#150]})
    same_frame(@279)
    same_frame(@283)
    full_frame(<strong i="25">@286</strong>,{},{})
    same_locals_1_stack_item_frame(<strong i="26">@289</strong>,Object[#151])
    same_frame(@301)

    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:78)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:87)
    at com.mygdx.lwjgl3.desktop.DesktopLauncher.main(DesktopLauncher.java:10)

Seleccione las plataformas afectadas

  • [] Android
  • [] iOS (robovm)
  • [] iOS (MOE)
  • [] HTML / GWT
  • [] Windows
  • [X] Linux
  • [ ] Mac OS

Comentario más útil

Este comentario fue un regalo del cielo. Para aquellos que encuentran esto, la sintaxis está un poco fuera de lugar. Intente agregar lo siguiente a sus dependencias :desktop en el archivo build.gradle nivel raíz:

compile ("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
    exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
}

Todos 3 comentarios

No puede incluir gdx-tools con lwjgl3 backend en dist, estos no son compatibles. ver https://github.com/libgdx/libgdx/issues/3726

De hecho, el proyecto gdx-tools tiene código central, editor y de prueba. El editor y el código de prueba se basan en el backend de Lwjgl. Si solo necesita algunas clases agnósticas de Lwjgl (por ejemplo, el empaquetador de texturas), puede excluir Lwjgl de la dependencia de gdx-tools en su compilación de gradle, algo así (no probado):

compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion" {
  exclude "com.badlogicgames.gdx:gdx-backend-lwjgl"
}

ver https://docs.gradle.org/3.3/userguide/dependency_management.html#sub : exclude_transitive_dependencies

Esto es solo una solución, IMO gdx-tools debe dividirse de alguna manera.

Espero que te ayude.

Este comentario fue un regalo del cielo. Para aquellos que encuentran esto, la sintaxis está un poco fuera de lugar. Intente agregar lo siguiente a sus dependencias :desktop en el archivo build.gradle nivel raíz:

compile ("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
    exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
}
¿Fue útil esta página
0 / 5 - 0 calificaciones