Skip to content

Compile failed with React Native 0.32 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
orange-beans opened this issue Sep 11, 2016 · 6 comments
Open

Compile failed with React Native 0.32 #19

orange-beans opened this issue Sep 11, 2016 · 6 comments

Comments

@orange-beans
Copy link

orange-beans commented Sep 11, 2016

Compile failed with the following message when I tried to build for Android :

Project_Path\node_modules\react-native-socketio\android\src\mai n\java\com\gcrabtree\rctsocketio\SocketIoReadableNativeMap.java:16: error: constru ctor ReadableNativeMap in class ReadableNativeMap cannot be applied to given types ;
public class SocketIoReadableNativeMap extends ReadableNativeMap {
^
required: HybridData
found: no arguments
reason: actual and formal argument lists differ in length
1 error
:SocketIo:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':SocketIo:compileDebugJavaWithJavac'.

    Compilation failed; see the compiler error output for details.

React Native Version: 0.32
Operating system: Win 7

@pj0579
Copy link

pj0579 commented Sep 12, 2016

you can add the default constructer by yourself

@mvnnn
Copy link

mvnnn commented Sep 22, 2016

I get same error. @pj0579 Please tell me which variable i need to declare in default constructor.

@mvnnn
Copy link

mvnnn commented Sep 23, 2016

@orange-beans You get the solution of this error.

@orange-beans
Copy link
Author

orange-beans commented Sep 26, 2016

@mvnnn Nope, I will wait until the problem is solved by the author. Currently I'm implementing socket.io-client directly, which is working no problem in Android, but got reception problem in iOS, suspect to be permission issue.

Following code for your reference.

SocketUtil.js

window.navigator.userAgent = 'react-native';
const io = require('socket.io-client/socket.io');
export const socket = io('http://127.0.0.1:80', {
  transports: ['websocket'], // you need to explicitly tell it to use websockets
});
export default io;

App.js

// Your Import
// ...
import { socket } from './SocketUtil';
import io from './SocketUtil';
// Use preset socket
socket.on('connect', () => {
  console.warn('connected!');
  socket.emit('hello', 'socket connected');
});
// Create new socket
const mySocket = io('http://XXX.XXX.XXX.XXX:80', {
  transports: ['websocket'],
});
mySocket.on('connect', () => {
  console.warn('connected!');
  socket.emit('hello', 'a different connection');
});
// Your Code
// ...

@davidperrenoud
Copy link

@orange-beans A bit unrelated, but what is the difference between using socket.io-client with React Native Websockets instead of this react-native-socketio module?

And do you know if socket.io-client supports HTTPS? Related: https://medium.com/@daywong/how-about-https-aff36566da38#.sqcmsehjz

@pj0579
Copy link

pj0579 commented Sep 27, 2016

@orange-beans @mvnnn add "protected SocketIoReadableNativeMap(HybridData hybridData) {
super(hybridData)
}" to NativeMap.java
or use socket.io-client it's working no problem in Android and Ios ,i have try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants