[Solved]Bundle big binary file into android apk
-
-
@SGaist
I try two solutions, both of them failproject layout
android extra_data --MobileNetSSD_deploy.caffemodel --MobileNetSSD_deploy.prototxt assets --Samples --MobileNetSSD_deploy.caffemodel --MobileNetSSD_deploy.prototxt logics main.cpp main.qml Page1.qml Page1Form.ui.qml part1.pro qml.qrc qtquickcontrols2.conf
android studio: 2.3.3.3
android api : 25(I want to pick a lower api, but cannot)
Qt5.9.1
os : win10 64bitsAdd following lines to .pro
SAMPLES_INSTALL_PATH=/assets/Samples # - setup the 'make install' step SAMPLE_FILES += $${SAMPLES_INSTALL_PATH}/MobileNetSSD_deploy.caffemodel SAMPLE_FILES += $${SAMPLES_INSTALL_PATH}/MobileNetSSD_deploy.prototxt samples.path = $${SAMPLES_INSTALL_PATH} samples.files += $${SAMPLE_FILES} samples.depends += FORCE INSTALLS += samples folder_01.source = extra_data folder_01.target = extra_data DEPLOYMENTFOLDERS += folder_01
None of them work, because the folder after build(without deploy) remain the same size with or without DEPLOYMENTFOLDERS or INSTALLS(extra files are bigger than 20MB)
-
From a quick look:
SAMPLES_INSTALL_PATH
is an absolute path sosamples
point to an invalid file list. -
@SGaist I change it to
SAMPLES_INSTALL_PATH=$$PWD/assets/Samples
This time pop out error message
17:21:00: Starting: "C:\Users\rrrr\Qt\3rdLibs\Qt\digia\Tools\mingw530_32\bin\mingw32-make.exe" "INSTALL_ROOT=C:\Users\rrrr\Qt\blogCodes2\cross_platform_dl\build-part3\android-build" install The filename, directory name, or volume label syntax is incorrect. Makefile:3015: recipe for target 'install_samples' failed mingw32-make: *** [install_samples] Error 1 17:21:02: The process "C:\Users\rrrr\Qt\3rdLibs\Qt\digia\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project part3 (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.1 for Android armv7)) When executing step "Copy application data"
-
AFAICS, you are using the same path to list the files and for the target directory. You should separate both. There's no
C:
drive on Android devices. -
I found a way to do it
1 : Click android folder(This folder will be created if you click the create template button on QtCreator)
2 : Copy your assets folder into the android folder
3 : Add following lines to you pro fileANDROID_PACKAGE_SOURCE_DIR = android DISTFILES += $$ANDROID_PACKAGE_SOURCE_DIR/assets
4 : The file in your assets cannot is compressed and cannot access by another library like opencv, std::ifstream etc. You have two solutions to open them
1 : Download your resources to your system the first time you run your program
2 : change suffix of your files as mp3, this can prevent compression of your assets. After that, copy the assets to somewhere you can access for anohter library to read them(ex : opencv)