Hi all and Sorry in advance for asking this question, but after five days of searching on stackoverflow and doing google-engineering I still got no answer for my question:
I would like to include several *.jar files to my project that shall be used by my android app after Qt compiled it.
Here is my environment:
- Installed Qt Creator 3.2.1(exe, not compiled from sources)
- main.cpp (starting Qt-Part)
- android/MainActivity.java (starting simple "Hello world" stuff and shall include different classes provided by the .jars (google-api-client-1.19.0.jar google-api-client-android-1.19.0.jar google-http-client-1.19.0.jar google-http-client-android-1.19.0.jar google-http-client-jackson-1.19.0.jar google-oauth-client-1.19.0.jar jackson-core-asl-1.9.13.jar jsr305-1.3.9.jar)
- android/AndroidManifest.xml
- android/libs containing the required .jars
After googling for that problem, I tried almost everything, getting the same result each time: the .jars are not found for the android application or the build process did not work:
[javac] C:\workspaces\qt_android\build-GsQt-Android\android-build\src\com\gservice\MainActivity.java:14: error: package com.google.android.gms.common does not exist [javac] import com.google.android.gms.common.ConnectionResult; [javac] ^ [javac] C:\workspaces\qt_android\build-GsQt-Android\android-build\src\com\gservice\MainActivity.java:15: error: package com.google.android.gms.common.api does not exist [javac] import com.google.android.gms.common.api.GoogleApiClient; [javac] ^\MainActivity.java:15: error: package com.google.android.gms.common.api does not exist
and so on, for all of the eight jars that shall be included.
Here are the things I tried to include them:
- created a folder within android, called "libs" and put my jars into it. After building the project, the folder and the jars have been copied to the build directory. By not to the device as it seems.
- included them as simple other files like the AndroidManifest and the MainActivity:
OTHER_FILES += \ android/libs/google-api-client-1.19.0.jar \ android/libs/google-api-client-android-1.19.0.jar \ android/libs/google-api-services-gmail-v1-rev2-1.18.0-rc.jar \ android/libs/google-http-client-1.19.0.jar \ android/libs/google-http-client-android-1.19.0.jar \ android/libs/google-http-client-jackson-1.19.0.jar \ android/libs/google-oauth-client-1.19.0.jar \ android/libs/jackson-core-asl-1.9.13.jar \ android/libs/jsr305-1.3.9.jar \ android/AndroidManifest.xml \ android/src/com/gservice/MainActivity.java \
- trying the assets-inclusion in the .pro file:
LIBS_INSTALL_PATH=/assets/libs
libraries.path=android/libs libraries.files += google-api-client-1.19.0.jar google-api-client-android-1.19.0.jar google-http-client-1.19.0.jar google-http-client-android-1.19.0.jar google-http-client-jackson-1.19.0.jar google-oauth-client-1.19.0.jar jackson-core-asl-1.9.13.jar jsr305-1.3.9.jar libraries.depends += FORCE INSTALLS += libraries
- creating a libraries.qrc file and include this via RESOURCES += libraries.qrc in the .pro file. libraries.qrc:
<RCC> <qresource prefix="/libs"> <file>android/libs/google-api-client-1.19.0.jar</file> <file>android/libs/google-api-client-android-1.19.0.jar</file> <file>android/libs/google-api-services-gmail-v1-rev2-1.18.0-rc.jar</file> <file>android/libs/google-http-client-1.19.0.jar</file> <file>android/libs/google-http-client-android-1.19.0.jar</file> <file>android/libs/google-http-client-jackson-1.19.0.jar</file> <file>android/libs/google-oauth-client-1.19.0.jar</file> <file>android/libs/jackson-core-asl-1.9.13.jar</file> <file>android/libs/jsr305-1.3.9.jar</file> </qresource> </RCC>
- trying with qmake (which returns an error, that rcc file's not found)
"rcc -binary google-api-client-1.19.0.jar -o google-api-client-1.19.0.rcc"
as additional parameter
... I really do not know what to do next, all of my Android-configurations (JDK, SDK, NDK, Ant) are at the correct place and are accessable, JAVA_HOME var and ANT var are set.
Two scentences at the end: the code I want to include for Android is a Google+ authentication app I already created with the Android ADT and that works fine. I shall transfer that working components into the build environment of Qt.
Thanks in advance for reading that looooong description and for helping me getting that solved!
Loyd