Build error on Android
Closed this issue · 3 comments
@benlau I am trying to build this for android. I cloned, and tried to just build the example app, but I get the following build errors. Are there any special steps I need to follow after cloning, or should everything just work for building the example app straight away? I tried with 5.6 and 5.7, Gradle and Ant.
/Users/<username>/Desktop/quickandroid/examples/build-quickandroidexample-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Release/android-build/src/quickandroid/example/ExampleService.java:2: error: cannot find symbol
import quickandroid.SystemDispatcher;
^
symbol: class SystemDispatcher
location: package quickandroid
/Users/<username>/Desktop/quickandroid/examples/build-quickandroidexample-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Release/android-build/src/quickandroid/example/ExampleService.java:17: error: package SystemDispatcher does not exist
SystemDispatcher.addListener(new SystemDispatcher.Listener() {
^
/Users/<username>/Desktop/quickandroid/examples/build-quickandroidexample-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Release/android-build/src/quickandroid/example/ExampleService.java:17: error: cannot find symbol
SystemDispatcher.addListener(new SystemDispatcher.Listener() {
^
symbol: variable SystemDispatcher
location: class ExampleService
Note: /Users/<username>/Desktop/quickandroid/examples/build-quickandroidexample-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Release/android-build/__qt5__android__files__/src/org/qtproject/qt5/android/bindings/QtActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
:compileDebugJava FAILED
BUILD FAILED
Total time: 4.421 secs
Building the android package failed!
-- For more information, run this command with --verbose.
11:08:55: The process "/Users/<username>/Qt5.6.0/5.6/android_armv7/bin/androiddeployqt" exited with code 14.
Error while building/deploying project quickandroidexample (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.6.0))
When executing step "Build Android APK"
Hi @ldanzinger,
The example program is expected to work with "ant" directly. Because the installation script of Java source files ( https://github.com/benlau/quickandroid/blob/master/quickandroid.pri#L38 ) do not work with gradle yet.
In your case, I guess the installation script of Java source files are not triggered. Could you check your build folder and see is android-build/src/quickandroid/SystemDispatcher.java available?
If not, then you could copy quickandroid/java/QuickAndroid/*.java to examples/quickandroidexample/android-sources/src/quickandroid . Then it should works with ant / gradle.
it doesn't work for me with ant, but if i manually copy like you suggest, it does work for me. Thanks for the help.
btw, I have just updated the example code. Now it should works with gradle too.