j0j00 / flutter_liquidcore Goto Github PK
View Code? Open in Web Editor NEWNode.js virtual machine for Android and iOS in Flutter.
Home Page: https://pub.dev/packages/flutter_liquidcore
License: BSD 2-Clause "Simplified" License
Node.js virtual machine for Android and iOS in Flutter.
Home Page: https://pub.dev/packages/flutter_liquidcore
License: BSD 2-Clause "Simplified" License
I'm on stable channel. (Flutter 1.12.13+hotfix.5).
$ git clone https://github.com/j0j00/flutter_liquidcore.git
$ cd flutter_liquidcore/example
$ flutter run
...
Running Xcode build...
Xcode build done. 1.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **Xcode's output:
↳
=== BUILD AGGREGATE TARGET Flutter OF PROJECT Pods WITH CONFIGURATION Debug ===
Undefined symbols for architecture x86_64:
"node::MainSource(node::Environment*)", referenced from:
node::LoadEnvironment(node::Environment*) in node.o
"node::DefineJavaScript(node::Environment*, v8::Localv8::Object)", referenced from:
node::Binding(v8::FunctionCallbackInfov8::Value const&) in node.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`
$ cat ios/Podfile.lock
PODS:
- Flutter (1.0.0)
- flutter_liquidcore (1.1.0):
- Flutter
- LiquidCore (~> 0.6)
- LiquidCore (0.6.2)
DEPENDENCIES:
- Flutter (from
.symlinks/flutter/ios
)- flutter_liquidcore (from
.symlinks/plugins/flutter_liquidcore/ios
)SPEC REPOS:
trunk:
- LiquidCoreEXTERNAL SOURCES:
Flutter:
:path: ".symlinks/flutter/ios"
flutter_liquidcore:
:path: ".symlinks/plugins/flutter_liquidcore/ios"SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_liquidcore: 532c2e9048572bcea66e080b100119cdfcf9dcb4
LiquidCore: a95bc50ffa8b249a5b5d7a1baa4d57fac4597d23PODFILE CHECKSUM: 44343c621236bf906b4fec69a7db15cfcaa6d5c8
COCOAPODS: 1.8.4
Can I use any npm module I want or are there limited number of libraries that I can use?
Thank you in advance
I'm running into this error after clicking the MicroService button in your example application:
Launching lib/main.dart on Lenovo S90 A in debug mode... Built build/app/outputs/apk/debug/app-debug.apk. I/View (21783): Touch down dispatch to io.flutter.view.FlutterView{10898e14 VFE..... .F...... 0,0-720,1280}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=399.44522, y[0]=336.73694, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=114429104, downTime=114429104, deviceId=7, source=0x1002 } I/View (21783): Touch up dispatch to io.flutter.view.FlutterView{10898e14 VFE..... .F...... 0,0-720,1280}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=399.44522, y[0]=336.73694, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=114429310, downTime=114429104, deviceId=7, source=0x1002 } I/mkdir (21783): Created directory /data/data/io.jojodev.flutter.liquidcoreexample/cache/__org.liquidplayer.node__/sessions/696636ad-fe38-49af-b84b-e882fbac8b49/home I/mkdir (21783): Created directory /data/data/io.jojodev.flutter.liquidcoreexample/cache/__org.liquidplayer.node__/sessions/696636ad-fe38-49af-b84b-e882fbac8b49/temp W/System.err(21783): java.lang.reflect.InvocationTargetException W/System.err(21783): at java.lang.reflect.Method.invoke(Native Method) W/System.err(21783): at java.lang.reflect.Method.invoke(Method.java:372) W/System.err(21783): at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:516) W/System.err(21783): at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:466) W/System.err(21783): at org.liquidplayer.node.Process.runInThread(Native Method) W/System.err(21783): at org.liquidplayer.node.Process.access$100(Process.java:23) W/System.err(21783): at org.liquidplayer.node.Process$1.run(Process.java:110) W/System.err(21783): at java.lang.Thread.run(Thread.java:818) W/System.err(21783): Caused by: java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: nodejs W/System.err(21783): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:794) W/System.err(21783): at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:684) W/System.err(21783): at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:80) W/System.err(21783): at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:189) W/System.err(21783): at io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:155) W/System.err(21783): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:98) W/System.err(21783): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:84) W/System.err(21783): at io.jojodev.flutter.liquidcore.handler.MicroServiceHandler$MicroServiceListener.onStart(MicroServiceHandler.java:164) W/System.err(21783): at io.jojodev.flutter.liquidcore.components.WrappedMicroService$1.onStart(WrappedMicroService.java:37) W/System.err(21783): at org.liquidplayer.service.MicroService.onProcessStart(MicroService.java:790) W/System.err(21783): at org.liquidplayer.node.Process.eventOnStart(Process.java:216) W/System.err(21783): at org.liquidplayer.node.Process.access$1000(Process.java:23) W/System.err(21783): at org.liquidplayer.node.Process$3.__nodedroid_onLoad(Process.java:349) W/System.err(21783): ... 8 more W/System.err(21783): Error: java.lang.reflect.InvocationTargetException W/System.err(21783): at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:526) W/System.err(21783): at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:466) W/System.err(21783): at org.liquidplayer.node.Process.runInThread(Native Method) W/System.err(21783): at org.liquidplayer.node.Process.access$100(Process.java:23) W/System.err(21783): at org.liquidplayer.node.Process$1.run(Process.java:110) W/System.err(21783): at java.lang.Thread.run(Thread.java:818) I/Unhandled(21783): There is an unhandled exception! I/Unhandled(21783): Error: java.lang.reflect.InvocationTargetException I/Unhandled(21783): [eval]:1 I/Unhandled(21783): global.__nodedroid_onLoad(); I/Unhandled(21783): ^ I/Unhandled(21783): I/Unhandled(21783): Error: java.lang.reflect.InvocationTargetException I/Unhandled(21783): at [eval]:1:8 I/Unhandled(21783): at ContextifyScript.Script.runInThisContext (vm.js:50:33) I/Unhandled(21783): at Object.runInThisContext (vm.js:139:38) I/Unhandled(21783): at Object.<anonymous> ([eval]-wrapper:6:22) I/Unhandled(21783): at Module._compile (module.js:635:30) I/Unhandled(21783): at evalScript (bootstrap_node.js:462:27) I/Unhandled(21783): at startup (bootstrap_node.js:163:9) I/Unhandled(21783): at bootstrap_node.js:608:3 D/NodeInstance(21783): exit(-1) called I/sessionWatchdog(21783): deleting session /data/data/io.jojodev.flutter.liquidcoreexample/cache/__org.liquidplayer.node__/sessions/696636ad-fe38-49af-b84b-e882fbac8b49
I tried running on both Flutter 1.7 and 1.9, using the simulator and an android device.
[✓] Flutter (Channel unknown, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G95, locale
en-PH)
• Flutter version 1.7.8+hotfix.4 at /Users/cormant/Applications/flutter
• Framework revision 20e59316b8 (2 months ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/cormant/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.8.0
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.38.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.4.1
[✓] Connected device (3 available)
• Lenovo S90 A • ffc1d89e • android-arm64 • Android 5.0.2 (API 21)
• macOS • macOS • darwin-x64 • Mac OS X 10.14.6 18G95
• web • web • web-javascript • Google Chrome 77.0.3865.90
• No issues found!
[✓] Flutter (Channel master, v1.10.6-pre.29, on Mac OS X 10.14.6 18G95, locale
en-PH)
• Flutter version 1.10.6-pre.29 at /Users/cormant/Applications/flutter
• Framework revision 919cc97f6a (9 days ago), 2019-09-20 14:57:05 -0700
• Engine revision 99092a0436
• Dart version 2.6.0 (build 2.6.0-dev.0.0 7c1821c4aa)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/cormant/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.8.0
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.38.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.4.1
[✓] Connected device (1 available)
• Lenovo S90 A • ffc1d89e • android-arm64 • Android 5.0.2 (API 21)
• No issues found!
As mentioned here LiquidPlayer/LiquidCore#102
FirebaseFirestore is not compatible with LiquidCore.
I've build a minimal, complete, and verifiable example that demonstrates it. The project has been created with flutter create and I didn't touched a thing. I just added the plugins in pubspec, added a signing team and set the min platform to 10.0.
https://github.com/long1eu/liquid_core_and_firestore_test
Any help is highly appreciated.
Using flutter_liquidcore code like the following returns errors:
ReferenceError: require is not defined; or
ReferenceError: import is not defined.
if (_jsContext == null) {
_jsContext = new JSContext();
String code = """
const API = require('./local-api/index.js')();
API.login("${aEmail}", "${aPassword}").then((output) => {
API.Stats("${userTag}", "${platform}").then((output) => {
console.log(output);
}).catch((err) => {
console.log(err);
});
}).catch((err) => {
console.log(err);
});
""";
Being a node.js environment and not being able to break my javascript out of that _jsContext bubble to reference other .js files seems important for the utility of flutter_liquidcore.
Hi,
I'm trying to run the example as is, and when pressing the MicroService
button the app crashes.
Attaching the flutter doctor
output if needed.
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G103, locale en-IL)
• Flutter version 1.12.13+hotfix.5 at /Users/liorrabin/Dev/flutter
• Framework revision 27321ebbad (2 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/liorrabin/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3, Build version 11C29
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• iPhone 11 Pro Max • 1C065D44-7D2B-4742-99AF-0A0DB989E84E • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• No issues found!
If i am trying to execute a JS function as follows - function show_number(){return 10+7;}() I am getting error that 'SyntaxError: Unexpected token )'
_jsContext.evaluateScript('function show_random_number(){return 10+7;}()');
Hey, how about to migrate to AndroidX libraries?
example project crash on iOS 13
@j0j00, I am getting "<LiquidCore/LiquidCore.h> file not found" error while running the example project
pods were successfully installed
JavaScriptCore(jsc) under macos is the same as it under ios, so maybe this plugin also supports macos?
I cloned the repo and opened the example folder. I used Android Studio on MacBook to run it on the iOS simulator of Xcode. It compiled and ran and I was able to see that JSContext worked. But the micro service didn't work. When the app first compiled and installed, and I clicked on micro service button the app crashed and exited. I didn't see any error log. Just "Lost connection to device". Later I opened the app and click on micro service button, and it didn't crash but didn't show any results either.
I really like this project and hope I can get an answer for this issue. Thanks!
Is it possible to include npm modules to work with liquidcore microservices?
I see that the example somehow requires the 'vm' module and it works with no issues, but I tried adding another require('..') statement and
Debug mode is normal,but release mode error
No such method.Did you make it public ?dart_liquidcore_type_
flutter version 1.13.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.