JaneaSystems / nodejs-mobile-samples

Repository for demo applications that use Node.js on Mobile
MIT License
168 stars 111 forks source link

Android: Return type of native function call does not match #36

Open 1407arjun opened 2 years ago

1407arjun commented 2 years ago

This is regarding the sample project for android (both with and without the nodejs folder). The return type of the Java_com_yourorg_sample_MainActivity_startNodeWithArguments function in native-lib.cpp is a jint whereas its counterpart in the MainActivity.java startNodeWithArguments is an Integer object (corresponds to a jobject). Android Studio was pointing out an error due to a mismatch in these types.

Two possible solutions:

  1. Replace jint by jobject in the native-lib.cpp
  2. Replace Integer by int in the MainActivity.java
JaosnHsieh commented 2 years ago

try this hello world example

there are some scripts needed changes I found it here