Unable to pass a simple message from QML to HTML vice-versa on Android device
-
Hello all,
Iam unable to pass a simple message from QML to HTML vice-versa on Android device
What iam trying to achieve: Iwant to pass a message between QMLVs HTML and vice-versa, Over a webchannel and websocket.
Problem statement: iam able to render the HTML file on the webview on the android device but iam facing issue in the communication between QML and HTML.
Main Error : I chromium: [INFO:CONSOLE(18)] "Uncaught ReferenceError: qt is not defined", source: file:///android_asset/index.html (18)
For more details i have attached the complete Error Log - https://pastebin.com/FtaF2trH
Complete source code is available in this public Google Drive Link - https://drive.google.com/file/d/1lGmbqQHzv9qJN_b9kPjiGsRjsYDu0VaW/view?usp=drive_link
for quick referance iam also attaching below pastebin urls:
Websocket.pro file - https://pastebin.com/s9iCt8UR
websockettransport.h file - https://pastebin.com/YgMVTdPw
main.cpp file - https://pastebin.com/x9LF42nc
index.html file - https://pastebin.com/kNkBjcaP
qwebchannel.js file - https://pastebin.com/zDL2SA6TCompilation environment details are as follows:
QtVersion -5.12.12
Kit – Android Qt 5.12.12 Clang arm64-v8a
JDK – java-8-openjdk-amd64
SDK Version: 8.0
NDK Version: 21.3.6528147
Steps i have followed to compile this & run on Android:
Step 1 - I have included webview, webchannel in websockets in the websocket. Pro file
Step 2 – i have added the required index.html, bootstrap.min.css and the qtwebchannel.js in the android asset folder like this
deployment.files += android_asset/index.html
deployment.files += android_asset/bootstrap.min.css
deployment.files += android_asset/qwebchannel.js
deployment.path = /assets
INSTALLS += deployment -