Skip to content

c++-based qt for android(necessitas) wizard gui example with serialization and with sendsms

Notifications You must be signed in to change notification settings

omac777/qtsnowloadcount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#qtsnowloadcount

c++-based qt for android(necessitas) wizard gui example with serialization and with sendsms
This project loves to open by default into the desktop target. In order to target the android project, you need to click on the projects button in the left pane of the qtcreator IDE.

Then select the android armv7 target.
Then click the configure button.
Then rebuild project.
Then Deploy and run.

If your android is connected to your computer, then the deploy and run will automagically happen onto your android phone.
If the SendSMS doesn't work, it's because the AndroidManifest.xml permissions have not been generated properly
into the apk file.
Modify the AndroidManifest.xml file outside of the qtcreator ide, then ndk_build then ant dist/debug.

#ENVIRONMENT VARIABLES TO FOR BUILDING OUTSIDE OF QTCREATOR IDE

export NDKROOT=/opt/NecessitasQtSDK/android-ndk
export ANDROID_NDK_ROOT=/opt/NecessitasQtSDK/android-ndk
export ANDROID_HOME=/opt/android-sdk-r22.3
alias qt520creator=/opt/Qt5.2.0/Tools/QtCreator/bin/qtcreator
cd qtsnowloadcount/

the original project was called snowloadcount.
I decided to rename it to qtsnowloadcount considering I made different guis gtk and qt.
rm snowloadcount.pro.user*
mv snowloadcount.pro qtsnowloadcount.pro

I configure project again for armv7
rebuild all project
but it complains about an error
cd build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/
make install INSTALL_ROOT=/home/loongson/build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/android-build

rebuild all project
cpp rebuild succeeds now to the android stuff
android redeploy project
installs ok, but permissions(android.permissions.SEND_SMS missing) exceptions crash the app
the permissions were added but they don't get moved to the build directory's AndroidManifest
so we have to edit these AndroidManifest.xml files ourselves and then ant debug/install ourselves.
cd qtsnowloadcount/
find ../qtsnowloadcount/ -name "AndroidManifest.xml" -print|etags -
find ../build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/ -name "AndroidManifest.xml" -print|xargs etags -a
tags-search "android.permission" and add the SEND_SMS permission and the permission exception won't crash the app on the phone and the sms will get sent.
cd /home/loongson/build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/
cd android-build/
ant debug
$ANDROID_HOME/platform-tools/adb -d install bin/QtApp-debug.apk
that's it.

#BUILD CYCLE

Here is my build cycle outside of qtcreator as much as possible:
Step 1)start qtcreator, create the project
Step 2)from the qtcreator ide, rebuild the project for the first time
Step 3)exit qtcreator ide

Step 4)
edit some .cpp/.h files in /home/loongson/qtsnowloadcount

Step 5)
cd /home/loongson/build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/

Step 6) build the .cpp/h files into a .so file
make

Step 7) move the .so file into the android build directory
make install INSTALL_ROOT=/home/loongson/build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/android-build

Step 8)now make the android install package file .apk
cd /home/loongson/build-qtsnowloadcount-Android_for_armeabi_GCC_4_8_Qt_5_2_0-Debug/android-build/
ant debug

Step 9)now install the android package onto the phone
$ANDROID_HOME/platform-tools/adb -d install bin/QtApp-debug.apk

Cycle back to Step 4)
If your app crashes on the phone then run the app from qtcreator ide to see the debug messages from the ide application console.

#WITHOUT QT CREATOR
export ANDROID_NDK_ROOT=/opt/android-ndk-r9c
export NDKROOT=/opt/android-ndk-r9c
export ANDROID_HOME=/opt/android-sdk-r22.3
/opt/Qt5.2.0/Tools/QtCreator/bin/qtcreator
cd $NDKROOT/samples/native-activity/
$ANDROID_HOME/tools/android update project -p . --target 26 --name native-activity
$NDKROOT/ndk-build V=1 -B
ant debug
$ANDROID_HOME/platform-tools/adb -d install $NDKROOT/samples/native-activity/bin/native-activity-debug.apk
alias qt520creator=/opt/Qt5.2.0/Tools/QtCreator/bin/qtcreator

About

c++-based qt for android(necessitas) wizard gui example with serialization and with sendsms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published