Skip to content

Repository explaining how to integrate Qt in an Android Studio project

Notifications You must be signed in to change notification settings

sanders9/qt-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

qt-android

This repository is a tutorial explaining how to integrate Qt in an Android Studio project. The main purpose is to create and retrieve data from a native sqlite3 database using Qt5Sql and Qt5Core. This last one will allow us to use the signals and slots features implemented in the Qt framework

Throughout this project I will explain the different folders located in this repository

Note : People interested about this project must be familiar with Android Studio, the Qt framework and the Android SDK and NDK

##1. the libs/ folder

This folder contains jar files needed for the qt framework. I found and import them from a qt project for android. I needed to include all of them because of the following error :

java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad. I had created a post on stackoverflow website (have a look on : http://stackoverflow.com/questions/36413504/java-lang-unsatisfiedlinkerror-jni-err-returned-from-jni-onload)

##2. the src/main/assets/database folder

This folder contains the sqlite database used in this tutorial. It is contains one table and three columns name / first_name / age

##3. the src/main/assets/sqldrivers folder

In this tutorial I use the QSqlDatabase class to query a sqlite database (see above). The plugin used by Qt to communicate with the QSqlite API needs some drivers. These last ones are located in this folder. It must be copied on the mobile phone and add to the library path list.

##4. the src/main/java/ folder

This folder contains java classes whose QtServiceAPI.java allows us to use native code

After retrieving data from the sqlite database, I notify the java part using a callback (cf QtDatabaseResponseListener.java)

##5. the src/main/jni/qt-library folder

Known issues and limitations

Point to develop

  • SQsqlDatabase not loaded
  • QCoreApplication.exec()

The repository is coming...

About

Repository explaining how to integrate Qt in an Android Studio project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published