Comments (14)
You made a typo. It's czyzby
, not czyzboy
. This is likely what causes the issue. Packages have to match exactly.
from gdx-lml.
I don't actively develop my LibGDX utilities lately, but I'll look into before the next release. If this issue blocks you, your best bet is to fork the library and add the method yourself - it's a very simple getter. There's no reason for reflection to fail to fetch the field value either, can you show me the code?
from gdx-lml.
thank you for your quick answer !
Unfortunately I'm not a very good Java Programmer so I don't usually do reflexion all the day.
If you want this is a piece of my code of core :
`
socket = ExtendedNet.getNet().newWebSocket(Constants.SERVER_HOST_IP, 2712);
nethandler = new NetworkHandler(l7s,socket);
socket.addListener(nethandler);
l7s.setNethandler(nethandler);
try
{
socket.connect();
}
catch(WebSocketException e)
{
e.printStackTrace();
}`
but I found in AndroidLauncher.java, when I call CommonWebSocket.iniate(); it return a new nvWebSocket by a factory, and there I tryed the reflexion but has I don' tknow exactly what to do i'm a bit lost.. I can indeed get the source code and modify by my own but I try to understand exactly how your lib work, I mean how exactly you do the bridge between nvWebSocket and platform WS Implementation
from gdx-lml.
This is the line where a new web socket is created - you probably want to add your extra settings there.
from gdx-lml.
ok thank you, So i just need to clone this github repo as usual and import it as a classic java project, is that right ?
from gdx-lml.
You could do that, but you'll find it easier to create a Java file with the same package and name in your project to patch the library. I remember doing it for some LibGDX classes back when I was starting as well - the compiler/build tool seems to prefer files from your project over the third-party libraries, so as long as you keep the same name and do not modify the publicly used interface, you should be fine.
- Add
com.github.czyzby.websocket.impl
package in your source folder. - Create
NvWebSocket.java
file. - Copy the source.
- Apply your changes.
from gdx-lml.
Ok thank you again and again for your help and patience;
I've create package as you described in my android project, added a the new java class into it but I got an error on Line 27 on NvWebSocketLister(this) and when I import it ( import com.github.czyzby.websocket.impl.NvWebSocketListener;) it say that the constructor doesnt accept this type of object :
from gdx-lml.
By the way, you should try using IntelliJ/Android Studio instead of Eclipse - especially if you plan on releasing a mobile version.
from gdx-lml.
YEA ! thank you the error disappear !!
Yes i'm using android studio when I want to test on my device the game and deploy a signed apk but I prefer eclipse so I code my core game with eclipse and use android studio only when I debug android and Packaging apk.
Thank you again for your support !
from gdx-lml.
ok this work on desktop.
However on android, it fail on gradle build here the error :
Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/github/czyzby/websocket/impl/NvWebSocket$1; Message{kind=ERROR, text=Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/github/czyzby/websocket/impl/NvWebSocket$1;, sources=[Unknown source file], original message=UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/github/czyzby/websocket/impl/NvWebSocket$1; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106) , tool name=Optional.of(Dex)}
from gdx-lml.
That's because both you and gdx-websockets
define the same class. I'm pretty sure there's a way to work around this, but I'm afraid Googling com.android.dex.DexException: Multiple dex files define
is your best bet for possible solutions.
The alternative is to clone this repo, modify the library source and publish the lib to your Maven Local with gradle build install
. Not sure what would require more time to resolve this issue, but you'll have to do some digging on how Gradle/Maven works before getting this right. :)
from gdx-lml.
ok czyzby thank you, I will try this today !
from gdx-lml.
Hello,
I come back with some news.
I think I understand way better how gradle work with maven integration etc..
If i understand correctly, my best bet is to clone this repo, made my change, build the new project into a jar file and then in the build.gradle file compile fileTree(dir: 'libs', include: '*.jar').
I read this usefull article : https://github.com/libgdx/libgdx/wiki/Dependency-management-with-Gradle#mavenizing-local-dependencies
But now i'm a little confused.
I understand that I can publish the lib to my local maven repo, and then from build.gradle script, I can retrieve it localy. ( compile "::"
compile ":::sources" etc..)
So what is the best solution ?
from gdx-lml.
When you clone the repository, you can execute gradle build install
to push all libraries to your Maven local. You can also change the version of the dependencies here. Replace libVersion
with your custom value and you can import the library in your project as any other artifact.
Make sure to add mavenLocal() to your repositories and then you can just add your custom modified library with:
compile "com.github.czyzby:gdx-websocket-common:1.2.3-YOUR_VERSION"
from gdx-lml.
Related Issues (20)
- Better websocket error handling
- Inconsistent behavior with percentage values HOT 1
- [Autumn] Components initiated 2 times HOT 3
- Window element disappears when changing skin HOT 5
- How to dispose batch of stage? HOT 2
- kiwi logger can not be used with LML Basic Template HOT 1
- pls help me the gwt websoket Thread is not supported HOT 5
- Why the background cover the LmlView HOT 4
- websocket with GWT HOT 7
- Access object field in a loop HOT 4
- FastClasspathScanner is outdated -- consider porting to ClassGraph
- gdx-lml multiple (Sub)View classes for a single view HOT 2
- Project still active? HOT 1
- Using gdx-websocket to connect to a Socket.IO server HOT 4
- List of lml tags HOT 2
- Tag Creation At Runtime HOT 14
- Invalid enum ordinal HOT 4
- Malformed snapshot JAR HOT 8
- Autumn as used in Liftoff not working due to incorrect include 1.9.1.9.6 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdx-lml.