0029631: Samples: build AndroidQt sample together with OCCT on Windows platform
[occt.git] / samples / qt / AndroidQt / ReadMe.md
CommitLineData
80eb9670 1OCCT AndroidQt sample for Android {#samples_qml_android_occt}
2==================
3
4This sample demonstrates a simple way of using OCCT libraries in Android application written using Qt/Qml.
5
6The connection between Qt/Qml and OCCT (C++) level is provided by proxy library, libAndroidQt.so, written in C++.
7The proxy library contains single C++ class AndroidQt encapsulating OCCT viewer and providing functionality to manipulate this viewer
8and to import OCCT shapes from supported format of CAD file (BREP).
9
10Requirements for building sample:
11* Java Development Kit 1.7 or higher
12* Qt 5.3 or higher
13* Android SDK from 2014.07.02 or newer
14* Android NDK r9d or newer
15* Apache Ant 1.9.4 or higher
1fa16152 16* OCCT compiled under Android platform and placed in directories:
17 * occt\libs\armeabi-v7a\*.so and occt\inc\*.hxx (libraries and include files of OCCT install)
18 * android\assets\opencascade\shared\Shaders\* (Shaders folder of OCCT install: \share\opencascade\resources\Shaders)
19 * 3rdparty\include\freetype2\*, 3rdparty\include\FreeImage.h and 3rdparty\libs\armeabi-v7a\libFreeImage.so and 3rdparty\libs\armeabi-v7a\libfreetype.so
20
21It is also possible to to correct OCCT.pri file an get resources from another tree of directories.
22
23When AndroidQt will be started, it may be helpful to have some default data files(BRep) on Device for opening in AndroidQt.
24Copy these files into "android\assets\opencascade\shared" and it will be installed to device during compilation procedure.
25
26Having prepared all these products, configure AndroidQt project for building sample:
80eb9670 27
28In QtCreator, open AndroidQt.pro project-file:
29~~~~
30 File -> Open file or Project...
31~~~~
32
33Specify Android configurations:
34~~~~
35Tools->Options->Android
36~~~~
37* In JDK location specify path to Java Development Kit
38* In Android SDK location specify path to Android SDK
39* In Android NDK location specify path to Android NDK
1fa16152 40(During this location definition, warning is possible and OK:
41 "Qt version for architecture mips is missing. To add the Qt version, select Options > Build & Run > Qt Versins.")
80eb9670 42* In Ant executable specify path to ant.bat file located in Apache Ant bin directory
43
1fa16152 44Make sure that "Android for armeabi-v7a" kit has been detected (present in the list).
80eb9670 45~~~~
46Tools->Options->Build & Run
47~~~~
48
1fa16152 49also or it can be checked or corrected in:
50~~~~
51Projects->Android for armeabi-v7a option should be checked
52~~~~
53
54Switch On device, connect it to PC and define it in Qt Creator:
55~~~~
56Projects->Manage Kits...->Devices->Device: Run on Android
57~~~~
58Check that "Current state" is "Ready to use" on this page.
59
60~~~~
61Projects->Build Settings->General: Shadow build is switched OFF
62~~~~
63
64Start configuration:
65
66~~~~
67Call Build -> Run qmake
68~~~~
69Check content of "Compile Output" view.
80eb9670 70
1fa16152 71In order to perform qmake correctly, for example if you have the following error:
80eb9670 72~~~~
1fa16152 73Running steps for project AndroidQt...
74Could not start process "<qt_dir>\android_armv7\bin\qmake.exe" <occt_dir>\samples\qt\AndroidQt\AndroidQt.pro -r -spec android-g++ "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
75Error while building/deploying project AndroidQt (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.3.2))
76When executing step "qmake"
80eb9670 77~~~~
78
80eb9670 79~~~~
1fa16152 80Projects->Build Settings->General: switch OFF Shadow build
81Build->Build Project "Android Qt"
82Build->Run
80eb9670 83~~~~
84
1fa16152 85Dialog to "Select Android Device" is shown. Select Compatible Device, Ok.
86In case of any error, see log in "Application Output" view.
80eb9670 87
80eb9670 88After successful build the application can be deployed to device or emulator.