khoren93 / flutter_zxing

Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
https://pub.dev/packages/flutter_zxing
MIT License
92 stars 52 forks source link

updating with recent zxing cpp #22

Closed yp25 closed 1 year ago

yp25 commented 2 years ago

hi @khoren93 thank you for your contribution for making flutter project with zxing cpp. are you planning to update your recent source code with recent zxing cpp ? I try to copy the new source code from zxing-cpp\core to flutter_zxing\ios\Classes\src\zxing\src (and CMakeLists.txt and zxing.cmake) but got many error. For example like this : C:/Users/home/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\locale:3689:17: note: candidate function not viable: requires 2 arguments, but 1 was provided byte_string to_bytes(const _Elem* __first, const _Elem* __last); ^ 1 warning and 1 error generated.

I'm still learning how to use cmake, and still trying to fix it. Maybe if you have a time please help to write step by step about how to updating the source code from zxing-cpp to your flutter_zxing project. Thank you

khoren93 commented 2 years ago

Hi @yp25 , Thanks for your response,

I have created a new branch dev, updated the zxing-cpp code to the latest version and fixed build issue.

For quickly updating the source code from zxing-cpp to the latest, you can use init.sh script.

khoren93 commented 2 years ago

The dev branch only works for android for now, i will try to fix for iOS later.

yp25 commented 2 years ago

@khoren93 Thank you. The new code zxing-cpp can decode / read micro qr code (Android wrapper), and flutter_zxing still can't. I try to modify : extensions.dart --> adding Format.MicroQRCode:'MicroQRCode', generated_bindings.dart --> adding static const int MicroQRCode = 65536; native_zxing.h --> adding MicroQRCode = (1 << 16),

but still can't decode / read micro qr code. could you help which part of your code I should modify ? Thanks

khoren93 commented 2 years ago

@yp25 I have added micro qr code support. You can view the changes here. Thanks.

nicoardi08 commented 1 year ago

hi @khoren93 Thank you for dev branch. I can compile it using Windows and run it on Android,

when I try to compile using MacBook M1 to run the app on iOS, I got this error

/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing/src/TextEncoder.cpp:12:10: fatal error: 'zueci.h' file not found

include "zueci.h"

         ^~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
warning: no rule to process file '/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/CMakeLists.txt' of type 'text' for architecture 'arm64' (in target 'flutter_zxing' from project 'Pods')
warning: no rule to process file '/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing/CMakeLists.txt' of type 'text' for architecture 'arm64' (in target 'flutter_zxing' from project 'Pods')
warning: no rule to process file '/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing.cmake' of type 'text' for architecture 'arm64' (in target 'flutter_zxing' from project 'Pods')
warning: no rule to process file '/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing/ZXingConfig.cmake.in' of type 'text' for architecture 'arm64' (in target 'flutter_zxing' from project 'Pods')
warning: no rule to process file '/Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing/ZXVersion.h.in' of type 'text' for architecture 'arm64' (in target 'flutter_zxing' from project 'Pods')

Result bundle written to path:
    /var/folders/sr/07n0x_rd2733jfdfldhl5g5w0000gn/T/flutter_tools.CGhB7a/flutter_ios_build_temp_dirlbSrpl/temporary_xcresult_bundle

Could not build the precompiled application for the device. Lexical or Preprocessor Issue (Xcode): 'zueci.h' file not found /Users/inc/flutter_project/flutter_zxing_dev_github/flutter_zxing-dev/ios/Classes/src/zxing/src/TextEncoder.cpp:11:9

any idea how to solve this ? Thanks

khoren93 commented 1 year ago

Hi @nicoardi08

Unfortunately at the moment I have no idea how to fix this problem for iOS. On the Android CMake command downloads this third part library, but iOS don't. I will be very grateful for any help.

Thanks.

axxel commented 1 year ago

I noticed that you recently upgraded to zxing-cpp 2.0. There the external dependency on the zueci project has been removed and the relevant code parts have been included in zxing-cpp directly (partly to prevent issues that people are having with the sourceforge git repo).

khoren93 commented 1 year ago

Dear @axxel

Thank you for your work on upgrading to zxing-cpp 2.0 and for including the relevant code parts directly. This change has made a big difference and the project is now working correctly. Thank you for your help!

yp25 commented 1 year ago

Thank you @axxel and @khoren93