There are answers about getting the tess-two
project integrated into an Android project within Android Studio, but many are out-dated and none used th
4. Configure Android Studio build for native functionality
4a. Link C++ Project with Gradle
First, check the tess-two
project for build files. You may select CMakeLists.txt or Android.mk files. Both are currently supported.
In this case, I used ndk-build
, which seemed like a good bet for integrating the native code.
For more information, see Android Studio documentation
4b. Manage Long Commands
In Windows, errors may be encountered if the command length grows too large. To prevent problems, use LOCAL_SHORT_COMMANDS
AND APP_SHORT_COMMANDS
in the Android.mk
file.
The "e=87" error is what you are avoiding by doing this:
For more on that topic, see stackoverflow question about error 87.
4c. Add Module Dependency for tess-two
In File > Project Structure > Dependencies use the + to add the tess-two
dependency:
4d. Build the Project and check .apk file for .so files
The build, which takes a long time, should complete now. Validate that the .apk
file contains the .so
files, created during the build. With the tess-two
libraries in an static initializer, run the project on your Android device: