[Edited]Teach me how to get 'QtAndroid.h' header file - android

I solve the problem.
#include <QtCore/private/qandroidextras_p.h>
The private folder is not included in the qtcore folder.
private folder is included in the "6.4.2(qt version)" folder. you have to copy the private folder to first QtCore folder.
and if you include "QtCore/private/qandroidextras_p.h", it will succeed.
and Refer to this article and request for permission, and it will succeed.
Requesting Android permissions in Qt 6
I hope this article will be helpful to others.

I solved the probelm.
The QtAndroid.h file has been replaced with qandroidextras_p.h on 6.2
https://doc.qt.io/qt-6/qtandroidprivate.html#requestPermission-1
we have to include header file, like this
#include <6.4.2(qt version)/QtCore/private/qandroidextras_p.h>
But when I include this header file, on Error message, it can't find the included header file in the qandroidextras_p.h file. This part seems to need to edit the included header file path of the qandroidextras_p.h file.

I succeeded in getting file permissions.
There is header file
#include <QtCore/private/qandroidextras_p.h>
I have to copy the private(QtCore/6.4.2/QtCore/[private]/qandroidextras_p.h) folder to first QtCore folder.
if you don't copy this folder, compiler can't find the some header files that declared on qandroidextras_p.h file.
and add the permission on AndroidManifest.xml file
Request Permission function
Requesting Android permissions in Qt 6
Create Android Manifest file
Where did the "Create AndroidManifest.xml" button go in Qt Creator 3.3.0?
Search file on qt
Recursively iterate over all the files in a directory and its subdirectories in Qt
when search files on android, root path is must be '/storage/emulated/0;' or '/mnt/sdcard'. not the QDir::rootPath();

Related

Get config.xml file of Cordova applications using Androguard

Is it possible to get the config.xml file that is generated by Cordova based applications using Adroguard?
I cannot find it under the /res folder and it is not listed in the output of get_files() method.
apktool, on the other hand, is able to get the config.xml from the apk that is use it on.
Since it is under res folder, You need to get it by unzipping the file to a temporary directory and then parse it using Axml parser. In get_files(), you must see "resources.arsc" file. The res files are part of that. You can do something like :
config_xml_path = os.path.join(<your apk unzipped path>, 'res', 'xml', 'config.xml')
with io.open(config_xml_path, 'rb') as axml_file:
parsed_axml_file = AXMLPrinter(axml_file.read())
axml_content = parsed_axml_file.get_buff().decode('utf-8)
parsed_axml = minidom.parseString(axml_content.encode('utf-8'))
You might get some errors if the config.xml is badly formatted but I am not including the solution to handle those case. I hope you will get an idea with the above example.

React-native-fs moveFile: ENOENT: no such file or directory, even though file exists

Using react native (0.44), react-native-fs (2.3.2) and react-native-zip. Trying to create a zip and then move it to another folder.
Expected:
Create zip file of files at source folder to target path
When success (promise resolves), move zip to another location
Actual:
Zip file creation succeeds:
Successfully created zip at /storage/emulated/0/Android/data/my_app/files/2017-06-07-14_09_39.zip
After zip creation promise resolves, check if source path exists:
fs.exists('/storage/emulated/0/Android/data/my_app/files/2017-06-07-14_09_39.zip')
-> true
But:
fs.moveFile('/storage/emulated/0/Android/data/my_app/files/2017-06-07-14_09_39.zip', targetPath)
-> Error: ENOENT: no such file or directory, open '/storage/emulated/0/Android/data/my_app/files/2017-06-07-14_09_39.zip'
Read and write permissions are OK in AndroidManifest etc.
Any ideas?
Check that "targetPath" includes both target directory path and target filename. Also check that the target directory exists.
One solution could be you forgot to add the filename so the destPath also, it's not enough to specify a directory.

Put an existing file to data\data\app_name\files during .apk installaion

I need to work with a file,that should be at data\data\app_name\files\ . That is now an SQL Database, so solution with SQLiteOpenHelper isn't ok for me. Also, I copyied that file to app_name\app\assets in my profect folder - that didn't work.
How to add that file to installation .apk, to put it in data\data\app_name\files during the installation?
Save your file in \res\raw within your project.
Then, you can access that file using:
InputStream databaseInputStream = getResources().openRawResource(R.raw.yourfile);
Make sure that the resource files are included correctly when generating the apk.

How to add add custom assets into .apk file?

I need to have some files in android assets folder, how can I add them using QtCreator/QMake?
Assuming you have the following structure in your source directory:
foo.pro
extra_data/file1
extra_data/file2
…
Adding the following to foo.pro should deploy the extra_data folder to assets://extra_data (exact path might differ, cannot verify right now) in the APK:
folder_01.source = extra_data
folder_01.target = extra_data
DEPLOYMENTFOLDERS += folder_01
If you are developing the application, then simply copy/paste the files in assets folder.
But if your application is already built and available as .apk file then you cannot modify any of its content.
Copying files to /5.2.0/android_armv7/src/android/java/assets did the trick

search.h-No such file or directory while porting libtiff on Android-tiff 4.0.1

I am trying to port libtiff on Android. The source version I am using is tiff 4.0.1.
I am building this source inside u1 android OS.
I am getting the below error when I run mmm external/tiff 4.0.1/
In file included from external/tiff-4.0.1/libtiff/tiffiop.h:33,
from external/tiff-4.0.1/libtiff/tif_dirread.c:42:
external/tiff-4.0.1/libtiff/tif_config.h:93:1: warning: "HAVE_MALLOC_H" redefined
In file included from <command-line>:0:
./system/core/include/arch/linux-arm/AndroidConfig.h:221:1: warning: this is the location of the previous definition
In file included from external/tiff-4.0.1/libtiff/tif_dirread.c:42:
external/tiff-4.0.1/libtiff/tiffiop.h:54:21: error: search.h: No such file or directory
I tries searching a lot on internet but could not get the issue.
Can any one provide me just an approx idea what could be wrong or which package is missing.
I resolved this issue finally. I hope this will help someone who is doing this work in future. We just need to remove the lines from libtiff/tiffiop.h where header file is being referenced.That worked for me.
Depending on your libtiff version, you can also just undefine HAVE_SEARCH_H in the config file tif_config.h which will then no longer include <search.h>:
In tif_config.h:
#ifndef ANDROID
/* Define to 1 if you have the <search.h> header file. */
#define HAVE_SEARCH_H 1
#endif

Categories

Resources