Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile QZXingLive example #34

Closed
JacekMarcinJ opened this issue May 25, 2017 · 11 comments
Closed

Can't compile QZXingLive example #34

JacekMarcinJ opened this issue May 25, 2017 · 11 comments

Comments

@JacekMarcinJ
Copy link

JacekMarcinJ commented May 25, 2017

Hi
Some time ago I successfully compile and run QZXingLive example. But I cant remember what it is needed to be done in order to do this. First thing what I need to do is fix this line in Utilities.java:

ArrayList<String> permissionsToRequest = new ArrayList<>();
Correct is:
ArrayList<String> permissionsToRequest = new ArrayList<String>();

What is strange to me is the necessity some Java code (personally I hate this language!).
But it helps only a little. And more serious bug incoming:

    [javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug\android-build\src\org\ftylitak\qzxing\Utilities.java:6: error: package android.support.v4.app does not exist
    [javac] import android.support.v4.app.ActivityCompat;
    [javac]                              ^
    [javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug\android-build\src\org\ftylitak\qzxing\Utilities.java:7: error: package android.support.v4.content does not exist
    [javac] import android.support.v4.content.ContextCompat;
    [javac]                                  ^
    [javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug\android-build\src\org\ftylitak\qzxing\Utilities.java:24: error: cannot find symbol
    [javac]             if (ContextCompat.checkSelfPermission(activity, permissions[i])
    [javac]                 ^
    [javac]   symbol:   variable ContextCompat
    [javac]   location: class Utilities
    [javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug\android-build\src\org\ftylitak\qzxing\Utilities.java:30: error: cannot find symbol
    [javac]             ActivityCompat.requestPermissions(activity,
    [javac]             ^
    [javac]   symbol:   variable ActivityCompat
    [javac]   location: class Utilities
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 4 errors

Why I want again compile this example? Because I want to check whether it hangs when capture rectangle is bigger than 0,5width and 0,5height of the mobile screen. When I set it bigger (say full screen size or 0,8width and 0,8height then my app hangs when capture screen runs (it runs correctly when it had 0,5width and 0,5height).

I need bigger capture rectangle, because for our need is essential to capture QZXing.DecoderFormat_CODE_128 codes. And with capture rectangle in size 0,5width and 0,5height of the screen it does not capture at all. So I think that resolution is too low. But bigger capture rectangle hangs my app (as I mention above).

I try to run QZXingLive example on Android 4.4.2 (Api 19). Maybe do you use feature some newer Api in this example?

@ftylitak
Copy link
Owner

Hello,

are you still experiencing issues with the compilation?
If not, is it ok for me to close the issue?

@JacekMarcinJ
Copy link
Author

JacekMarcinJ commented Jun 20, 2017

I try to compile examples today with following results:

  1. on Windows it compile and run
  2. it cross compile (for Android) on Windows and fails to build APK with the same errors as I listed above.
    I must admit, that I don't use recent sources - because you don't mention about any changes.
    So: from my point of view this issue is not solved.

@ftylitak
Copy link
Owner

I would suggest you increase the target API level from 19 (Android 4.4.x) to something larger. I would expect that after downloading the new SDKs your application would be functional for Android 4.4 as well.

For instance, i use target API level 25 and in have installed the same APK to an Android 4.2 and it worked. Could this be a solution to your case?

@JacekMarcinJ
Copy link
Author

JacekMarcinJ commented Jun 20, 2017

I installed API 25 via SDK Manager.exe and opened QZXingLive example and checked whether API 25 is selected (it was - even it not existed before), run qmake, and rebuild. But still no luck... I got following error:
`Generating Android Package
Input file: C:/QTSRC/external/qzxing/examples/build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release/android-libQZXingLive.so-deployment-settings.json
Output directory: C:/QTSRC/external/qzxing/examples/build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release/android-build/
Application binary: C:/QTSRC/external/qzxing/examples/build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release/libQZXingLive.so
Android build platform: android-25
Install to device: No
Buildfile: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 25.2.5
[checkenv] Installed at C:\tools\AndroidSdk145

-setup:
[echo] Project Name: QtApp
[gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 25.0.1
[echo] Resolving Build Target for QtApp...
[gettarget] Project Target: Android 7.1.1
[gettarget] API level: 25
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\res
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\rsObj
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\rsLibs
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\gen
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\classes
[mkdir] Created dir: C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for QtApp...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] Found 2 AIDL files.
[aidl] Compiling 2 AIDL files.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 13 source files to C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\bin\classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\src\org\ftylitak\qzxing\Utilities.java:6: error: package android.support.v4.app does not exist
[javac] import android.support.v4.app.ActivityCompat;
[javac] ^
[javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\src\org\ftylitak\qzxing\Utilities.java:7: error: package android.support.v4.content does not exist
[javac] import android.support.v4.content.ContextCompat;
[javac] ^
[javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\src\org\ftylitak\qzxing\Utilities.java:24: error: cannot find symbol
[javac] if (ContextCompat.checkSelfPermission(activity, permissions[i])
[javac] ^
[javac] symbol: variable ContextCompat
[javac] location: class Utilities
[javac] C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\src\org\ftylitak\qzxing\Utilities.java:30: error: cannot find symbol
[javac] ActivityCompat.requestPermissions(activity,
[javac] ^
[javac] symbol: variable ActivityCompat
[javac] location: class Utilities
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.

BUILD FAILED
C:\tools\AndroidSdk145\tools\ant\build.xml:716: The following error occurred while executing this line:
C:\tools\AndroidSdk145\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.

Total time: 1 second
[javac] 4 errors
[javac] 3 warnings
Warning: QML import could not be resolved in any of the import paths: QZXing
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
Building the android package failed!
-- For more information, run this command with --verbose.
11:11:23: Proces "C:\qt\Qt5.8.0-android-sdk\5.8\android_armv7\bin\androiddeployqt.exe" zakończył się kodem wyjściowym 14.
Błąd budowania / instalowania projektu QZXingLive (zestaw narzędzi: Android dla armeabi-v7a (GCC 4.9, Qt 5.8.0))
Podczas wykonywania kroku "Zbuduj Android APK"
11:11:23: Czas trwania: 01:14.

@ftylitak
Copy link
Owner

This issue is because your project is setup to use "ant" instead of "gradle".
To change this setting, got to Projects -> Expand the "Build Android APK" -> Tick the "User Gradle"
capture1
capture2

@JacekMarcinJ
Copy link
Author

Ok! Now I got other error:
`FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':mergeDebugResources'.

Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\build\intermediates\exploded-aar\com.android.support\appcompat-v7\25.0.1\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png into C:\QTSRC\external\qzxing\examples\build-QZXingLive-Android_dla_armeabi_v7a_GCC_4_9_Qt_5_8_0_6ecf1f-Release\android-build\build\intermediates\res\merged\debug\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6 mins 6.382 secs
Warning: QML import could not be resolved in any of the import paths: QZXing
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
Building the android package failed!
-- For more information, run this command with --verbose.
14:41:16: Proces "C:\qt\Qt5.8.0-android-sdk\5.8\android_armv7\bin\androiddeployqt.exe" zakończył się kodem wyjściowym 14.
Błąd budowania / instalowania projektu QZXingLive (zestaw narzędzi: Android dla armeabi-v7a (GCC 4.9, Qt 5.8.0))
Podczas wykonywania kroku "Zbuduj Android APK"
14:41:16: Czas trwania: 06:12.`

@ftylitak
Copy link
Owner

This is because the path name becomes very long. In the project settings either deactivate the shadow build, or just shorten the shadow build folder name (i.e. from "build-QZXingLive-Desktop_Qt_5_9_0_MinGW_32bit2-Debug" to "QZXingLive-android").

@ekke
Copy link

ekke commented Jun 20, 2017

from time to time I'm also getting this error from my projects.
normaly it helps simply to build again, then mergeDebugResources is successfully wothout shortening any pathes. curious - but it works

@JacekMarcinJ
Copy link
Author

JacekMarcinJ commented Jun 20, 2017

@ftylitak - Many thanks! Now it works on Android! Now you can close this thread.

@ftylitak
Copy link
Owner

I am glad i helped! :)

@kpkale
Copy link

kpkale commented Oct 3, 2017

Hello
I am trying to compile the example for android and I getting exactly same errors.
After using gradle, I get the following error.

Can you please guide on what could be wrong here.
FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/kaushik/QtProjects/QZingLive-Android-Release/android-build/build.gradle' line: 17

  • What went wrong:
    A problem occurred evaluating root project 'android-build'.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

Greatful for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants