fischmat / mysticlight4j

Java Library for controlling MSI Mystic Light compatible LEDs
MIT License
7 stars 1 forks source link

NoSuchMethodError #5

Open NeariX67 opened 4 years ago

NeariX67 commented 4 years ago

Hey, i wasnt quite able to make this project runable.

Neither implementation example of your readme seem to work for me.

Here's my Class:

package com.nearix.test;

import java.util.Collection; import java.util.List;

import de.matthiasfisch.mysticlight4j.Device; import de.matthiasfisch.mysticlight4j.LED; import de.matthiasfisch.mysticlight4j.MysticLight4j; import de.matthiasfisch.mysticlight4j.api.DeviceInfo; import de.matthiasfisch.mysticlight4j.api.LedInfo; import de.matthiasfisch.mysticlight4j.api.MysticLightAPI;

public class Main { public static void main(String[] args) { MysticLight4j mysticLight = new MysticLight4j(); Collection devices = mysticLight.getAllAvailableDevices(); for (Device device : devices) { String id = device.getIdentifier(); // Unique ID of the device String name = device.getName(); // Display name of the device System.out.println(name); List leds = device.getLEDs(); // The LED groups on the device }

// Console: // C:\Users\NeariX\OneDrive - OSZ IMT\Coding\Eclipse\WorkSpace\MSI Mystic Light Java // Exception in thread "main" java.lang.NoSuchMethodError: // at de.matthiasfisch.mysticlight4j.api.MysticLightNativeBinding.getLedInfo(Native Method) // at de.matthiasfisch.mysticlight4j.api.MysticLightAPI.getLedInfo(MysticLightAPI.java:151) // at de.matthiasfisch.mysticlight4j.LED.(LED.java:33) // at de.matthiasfisch.mysticlight4j.Device.lambda$0(Device.java:29) // at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) // at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) // at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) // at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) // at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) // at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) // at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) // at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) // at de.matthiasfisch.mysticlight4j.Device.(Device.java:30) // at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) // at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) // at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) // at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) // at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) // at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) // at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) // at de.matthiasfisch.mysticlight4j.MysticLight4j.getAllAvailableDevices(MysticLight4j.java:64) // at com.nearix.test.Main.main(Main.java:13)

    MysticLightAPI.initialize();  
    DeviceInfo[] devices = MysticLightAPI.getDeviceInfo();  
    for (DeviceInfo device : devices) {  
        // Prints the unique identifier of the device  
      System.out.println(device.getDeviceType());  
      System.out.println("LED groups for this device:");  
     for (int i = 0; i < device.getLedCount(); i++) {  
            LedInfo led = MysticLightAPI.getLedInfo(device.getDeviceType(), i);  
      System.out.println(led.getName());  
      }  
    }

// Console: // MSI_MB // LED groups for this device: // Exception in thread "main" java.lang.NoSuchMethodError: // at de.matthiasfisch.mysticlight4j.api.MysticLightNativeBinding.getLedInfo(Native Method) // at de.matthiasfisch.mysticlight4j.api.MysticLightAPI.getLedInfo(MysticLightAPI.java:151) // at com.nearix.test.Main.main(Main.java:25)

}

}

It doesn't seem to find the getLedInfo Method.

fischmat commented 4 years ago

Hi NeariX67,

unfortunately I could not reproduce the issue. It is weird that the native methods were first found during initialization and retrieval of the device infos, but the getLedInfo method was not.

I created a repository with an example usage of the native API that is working for me: https://github.com/fischmat/mysticlight4j_example Please note that you need to download the Mystic Light SDK from here and put the DLLs in the same folder as the native DLLs (as I can't push the proprietary binaries here). Also make sure that the place where your DLLs are located is the working directory of your run configuration. I recompiled the mysticlight4j_native.dll and mysticlight4j_native_x64.dll and pushed them to develop. They can be found here and here respectively.

Please let me know if you're able to get the example project running.

Bests,

Matthias

NeariX67 commented 4 years ago

--Wolte nur den Issue auf Englisch schreiben falls es noch jemanden mit dem Problem gibt

Hab mal dein Example getestet, geht ebenso nicht: Console: MPG Z490 GAMING PLUS (MS-7C75) Exception in thread "main" java.lang.NoSuchMethodError: at de.matthiasfisch.mysticlight4j.api.MysticLightNativeBinding.getLedInfo(Native Method) at de.matthiasfisch.mysticlight4j.api.MysticLightAPI.getLedInfo(MysticLightAPI.java:151) at com.nearix.test.Main.main(Main.java:19)

Meine Libraries: commonds-lang3-3.10.jar guava-29.0-jre jsr305-3.0.2 lombok

SDK Files: MysticLight_SDK.dll MysticLight_SDK.h MysticLight_SDK_x64.dll mysticlight4j_native.dll mysticlight4j_native_x64.dll

Kannst du mir vllt mal die MysticLight SDK Dateien hochladen? Vielleicht verwenden wir eine unterschiedliche Version. Andernfalls kann ich mir das echt nicht erklären. Mfg