hnvn / flutter_image_cropper

A Flutter plugin for Android and iOS supports cropping images
971 stars 374 forks source link

Not able to to build project in ios #152

Open Virendra-Varma opened 4 years ago

Virendra-Varma commented 4 years ago

Hi I am getting this issue `/Users/icsssd347/Documents/salesapp_bcsind/BackUP/26:04:2020/sales_team_app/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/TOCropViewController.m:23: /Users/icsssd347/Documents/salesapp_bcsind/BackUP/26:04:2020/sales_team_app/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/TOCropViewController.h:25:9: fatal error: 'TOCropViewConstants.h' file not found

import "TOCropViewConstants.h"

`

hcaz commented 4 years ago

Can you post more information about your setup, such as your podfile?

Virendra-Varma commented 4 years ago

`# Uncomment this line to define a global platform for your project

platform :ios, '9.0'

CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } def parse_KV_file(file, separator='=') file_abs_path = File.expand_path(file) if !File.exists? file_abs_path return []; end generated_key_values = {} skip_line_start_symbols = ["#", "/"] File.foreach(file_abs_path) do |line| next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } plugin = line.split(pattern=separator) if plugin.length == 2 podname = plugin[0].strip() path = plugin[1].strip() podpath = File.expand_path("#{path}", file_abs_path) generated_key_values[podname] = podpath else puts "Invalid plugin specification: #{line}" end end generated_key_values end target 'Runner' do use_frameworks! use_modular_headers!

Flutter Pod

copied_flutter_dir = File.join(dir, 'Flutter') copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)

Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.

# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
  raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
  FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
  FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end

end

Keep pod path relative so it can be checked into Podfile.lock.

pod 'Flutter', :path => 'Flutter'

Plugin Pods

Prepare symlinks folder. We use symlinks to avoid having Podfile.lock

referring to absolute paths on developers' machines.

system('rm -rf .symlinks') system('mkdir -p .symlinks/plugins') plugin_pods = parse_KV_file('../.flutter-plugins') plugin_pods.each do |name, path| symlink = File.join('.symlinks', 'plugins', name) File.symlink(path, symlink) pod name, :path => File.join(symlink, 'ios') end end

Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.

install! 'cocoapods', :disable_input_output_paths => true post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' end end end `

divyanshub024 commented 4 years ago

I'm facing the same issue here.

hcaz commented 4 years ago

I am pretty sure this is a problem with the underlying plugin TOCropViewController and not this package, but neither have been updated recently and this error seems to be new today as builds succeded yesterday for me at least.

deus-magna commented 3 years ago

Has this issue been resolved? Currently I cannot build my app on a physical device, only on an iOS emulator.

This is Xcode log:

dyld: Library not loaded: @rpath/TOCropViewController.framework/TOCropViewController Referenced from: /private/var/containers/Bundle/Application/CBE27F52-D358-4189-8B33-7561FA2E2609/Runner.app/Runner Reason: image not found (lldb)

hcaz commented 3 years ago

We are no longer experiencing this with version 1.2.3. Looks like TOCropViewController updated to 2.5.3 14 days ago, maybe try a flutter clean and see if that helps?

deus-magna commented 3 years ago

We are no longer experiencing this with version 1.2.3. Looks like TOCropViewController updated to 2.5.3 14 days ago, maybe try a flutter clean and see if that helps?

Thanks, I was using version 1.2.2, updating my version to 1.2.3 and running flutter clean solve the problem.

osaxma commented 3 years ago

I'm having the same problem as well with iOS builds, but once I disable the image_cropper package, the iOS runs fine.

I received all sort of errors that I tried to fix by updating everything related to Flutter and Pods (removing, updating, setting up and installing repos) but this was the last error I got and it won't go away with the mentioned fixes:

Warning: Podfile is out of date
  This can cause issues if your application depends on plugins that do not support iOS.
  See https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms for details.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/45197 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile

for reference, here's flutter doctor:

[✓] Flutter (Channel master, 1.21.0-10.0.pre.161, on Mac OS X 10.15.5 19F101, locale en)
    • Flutter version 1.21.0-10.0.pre.161 at /Users/osaxma/Tools/flutter
    • Framework revision db705b81e3 (3 hours ago), 2020-08-19 00:41:06 -0700
    • Engine revision 0b330467da
    • Dart version 2.10.0 (build 2.10.0-38.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/osaxma/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.13.2

[✓] Connected device (3 available)
    • iPhone 11 Pro Max (mobile) • 1C16BCF3-15BB-44A0-B838-0E9C8EF639DD • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
    • Web Server (web)           • web-server                           • web-javascript • Flutter Tools
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 84.0.4147.125

• No issues found!
hcaz commented 3 years ago

@OsaXma Can you try checking out the flutter stable branch and trying again? I have a feeling this package might not be compatible with the latest updates in flutter just yet. The latest version I have it working against is flutter version 1.17.5

osaxma commented 3 years ago

@hcaz The iOS build worked on the latest stable channel.

Flutter 1.20.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision bbfbf1770c (6 days ago) • 2020-08-13 08:33:09 -0700
Engine • revision 9d5b21729f
Tools • Dart 2.9.1
osaxma commented 3 years ago

@hcaz I actually don't know what happened but after to switching back to master 1.21.0-10.0.pre.161, I don't get the error anymore.

Every step in the way, I did the following:

hcaz commented 3 years ago

@OsaXma it might just have been that you needed a flutter clean to clear out any old build files. But it is recommended to stay on the stable channel for production unless you have a specific reason to move away from it.

Beautylivery commented 3 years ago

I also running into this issue :/

It is related to https://github.com/TimOliver/TOCropViewController/issues/424 But makes it impossible to build :(

Xcode build done.                                           144,7s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController");
    this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to
    the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Views/TOCropOverlayView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a
    malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this
    indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the
    same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Views/TOCropScrollView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a
    malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Views/TOCropToolbar.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a
    malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Views/TOCropView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a
    malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/TOCropViewController.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a
    malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
    2020-08-24 21:51:29.126 xcodebuild[12392:103057] warning:  The file reference for "Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController");
    this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to
    the same path.
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_appcenter_bundle-3.2.0+2/ios/Classes/SwiftFlutterAppcenterBundlePlugin.swift:20:9: warning: result of call to 'register(binaryMessenger:)' is unused
            register(binaryMessenger: registrar.messenger());
            ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    While building module 'firebase_core' imported from /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_storage-4.0.0/ios/Classes/FLTFirebaseStoragePlugin.m:8:
    In file included from <module-includes>:1:
    In file included from /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
    In file included from /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_core-0.5.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
    /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_core-0.5.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
    '/Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
    #import <FirebaseCore/FirebaseCore.h>
            ^
    1 error generated.
    /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_storage-4.0.0/ios/Classes/FLTFirebaseStoragePlugin.m:8:9: fatal error: could not build module 'firebase_core'
    #import <firebase_core/FLTFirebasePlugin.h>
     ~~~~~~~^
    2 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h (in target
    'TOCropViewController' from project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropOverlayView.h (in target 'TOCropViewController' from
    project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.h (in target
    'TOCropViewController' from project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropScrollView.h (in target 'TOCropViewController' from
    project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropToolbar.h (in target 'TOCropViewController' from
    project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropView.h (in target 'TOCropViewController' from
    project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/TOCropViewController.h (in target 'TOCropViewController' from
    project 'Pods')
    warning: Skipping duplicate build file in Copy Headers build phase:
    /Users/kaibaier/Me/Entwicklung/Project_Beautylivery/Flutter/Projects/beautylivery-flutter-ac/beautylivervy_appcenter/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h (in target
    'TOCropViewController' from project 'Pods')

Could not build the precompiled application for the device.
k3v1n-uncle commented 3 years ago

flutter_image_cropper:1.3.1 flutter:1.20.4 xcode:12 i can flutter run but can not flutter build ios

warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropOverlayView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropScrollView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropToolbar.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Views/TOCropView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/TOCropViewController.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/iosappjingda/Documents/jingda_oa/ios/Pods/TOCropViewController/Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h (in target 'TOCropViewController' from project 'Pods')

ndhbr commented 3 years ago

TimOliver/TOCropViewController#424

I have the same problem. Did you manage to solve it?