unable to add the html file into the android asset during compilation on Andriod
-
i have tried by adding the following lines in my .pro file .Also i have kept the index.html in the root folder as main.qml file. Also added the index.html into the resource file by right clicking the qml.qrc and added it using the open in editor option.
RESOURCES += qml.qrc deployment.files += /index.html deployment.path = /assets INSTALLS += deployment
in the main.qml file i have used the below code .
WebView { id: webView anchors.fill: parent anchors.margins: 5 url:"file:///android_asset/index.html" onLoadingChanged: { if (loadRequest.errorString) { console.error(loadRequest.errorString); } } }
i manually checked the build folder , the index.html file did not get added to this location "build-webviewonandroid-Android_Qt_5_12_12_Clang_armeabi_v7a-Debug/android-build/assets$ "
Also the code got compiled and iam able to deploy to a physical device . only getting the following error : E libwebviewonandroid.so: qml: net::ERR_FILE_NOT_FOUND
-
Hi,
Intuitively:
deployment.files += /index.html
looks wrong. You are stating theindex.html
is at the root of your filesystem. -
i have tried by adding the following lines in my .pro file .Also i have kept the index.html in the root folder as main.qml file. Also added the index.html into the resource file by right clicking the qml.qrc and added it using the open in editor option.
RESOURCES += qml.qrc deployment.files += /index.html deployment.path = /assets INSTALLS += deployment
in the main.qml file i have used the below code .
WebView { id: webView anchors.fill: parent anchors.margins: 5 url:"file:///android_asset/index.html" onLoadingChanged: { if (loadRequest.errorString) { console.error(loadRequest.errorString); } } }
i manually checked the build folder , the index.html file did not get added to this location "build-webviewonandroid-Android_Qt_5_12_12_Clang_armeabi_v7a-Debug/android-build/assets$ "
Also the code got compiled and iam able to deploy to a physical device . only getting the following error : E libwebviewonandroid.so: qml: net::ERR_FILE_NOT_FOUND
@Rajeshkannan ..I have kept this index.html file in the same location as main.qml...both are at root folder. My understanding was during the build process this index .html gets automatically copied into the android's asset folder
-
@Rajeshkannan ..I have kept this index.html file in the same location as main.qml...both are at root folder. My understanding was during the build process this index .html gets automatically copied into the android's asset folder
@Rajeshkannan in the line
deployment.files +=
you have to give the path to the actual file within your project. -
@Rajeshkannan in the line
deployment.files +=
you have to give the path to the actual file within your project.hi ,
Below are the steps i did in ubuntu , to add the assets for android and it worked. Thank you!!!
Step 1: Create a folder called android_asset in the root directory where you have the main.qml then add all the index.html files into it.
Step 2: Right click the Rootfolder and add the android_asset folder by choosing the "Add Existing Directory".
Step 3: paste the following in the .pro file
deployment.files += android_asset/index.html
deployment.path = /assets
INSTALLS += deploymentI compiled and run ..it worked
-
hi ,
Below are the steps i did in ubuntu , to add the assets for android and it worked. Thank you!!!
Step 1: Create a folder called android_asset in the root directory where you have the main.qml then add all the index.html files into it.
Step 2: Right click the Rootfolder and add the android_asset folder by choosing the "Add Existing Directory".
Step 3: paste the following in the .pro file
deployment.files += android_asset/index.html
deployment.path = /assets
INSTALLS += deploymentI compiled and run ..it worked
@Rajeshkannan you're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so other forum users may know a solution has been found :-)
-
@Rajeshkannan you're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so other forum users may know a solution has been found :-)
@SGaist ,
Just an additional note,in the main.qml we need to use like below:
WebView {
id: webView
anchors.fill: parent
anchors.margins: 5
url:"file:///android_asset/index.html"
onLoadingChanged: {
if (loadRequest.errorString)
{ console.error(loadRequest.errorString); }
}WebChannel { id: channel registeredObjects: [someObject] } }
-