davidmartos96 / sqflite_sqlcipher

SQLite flutter plugin
BSD 2-Clause "Simplified" License
96 stars 41 forks source link

IOS archiving failed #95

Open amrLLSE opened 1 week ago

amrLLSE commented 1 week ago

Hello

I'm facing this error while archiving the app, it builds normally when building it to a device, but not archiving in XCode.

I have read the docs and added this to my pubspec.yaml, fully cleaned the project and caches in both flutter and ios module, updated CocoaPods to latest, unfortunately nothing works.

Prepare build
error: Multiple commands produce '/Users/username/Library/Developer/Xcode/DerivedData/Runner-fcxhffjmdtbzsbcfbguxqatlgxnj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'
    note: Target 'FMDB-SQLCipher' (project 'Pods') has create directory command with output '/Users/username/Library/Developer/Xcode/DerivedData/Runner-fcxhffjmdtbzsbcfbguxqatlgxnj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'
    note: Target 'SQLCipher-SQLCipher' (project 'Pods') has create directory command with output '/Users/username/Library/Developer/Xcode/DerivedData/Runner-fcxhffjmdtbzsbcfbguxqatlgxnj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'

Multiple commands produce '/Users/username/Library/Developer/Xcode/DerivedData/Runner-fcxhffjmdtbzsbcfbguxqatlgxnj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SQLCipher.bundle'

Build failed    12/06/2024, 4:03 PM    20.7 seconds
davidmartos96 commented 1 week ago

@amrLLSE Could you share your full pubspec.yaml file?

amrLLSE commented 1 week ago

@davidmartos96 I have run flutter pub deps and these are all the results related to sql

├── cached_network_image 3.3.1
│   ├── cached_network_image_platform_interface 4.0.0
│   │   ├── flutter...
│   │   └── flutter_cache_manager...
│   ├── cached_network_image_web 1.2.0
│   │   ├── cached_network_image_platform_interface...
│   │   ├── flutter...
│   │   └── flutter_cache_manager...
│   ├── flutter_cache_manager 3.3.2
│   │   ├── clock...
│   │   ├── collection...
│   │   ├── file...
│   │   ├── flutter...
│   │   ├── http...
│   │   ├── path...
│   │   ├── path_provider...
│   │   ├── rxdart...
│   │   ├── sqflite...
│   │   └── uuid...
│   ├── octo_image 2.0.0
│   │   └── flutter...
│   └── flutter...
├── sqflite 2.0.3
│   ├── flutter...
│   ├── path...
│   └── sqflite_common...
├── sqflite_sqlcipher 3.1.0+1
│   ├── sqflite_common 2.5.4
│   │   ├── meta...
│   │   ├── path...
│   │   └── synchronized...
│   ├── synchronized 3.1.0+1
│   ├── flutter...
│   └── path...

And this is the part I have added from the plugin docs:

dependency_overrides:
  sqflite:
    git:
      url: https://www.github.com/davidmartos96/sqflite_sqlcipher.git
      path: sqflite
      ref: fmdb_override

My Dart & Flutter versions: Dart SDK 3.3.4 Flutter SDK 3.19.6

In pubspec.yaml:

  sdk: ">=3.0.0"
davidmartos96 commented 1 week ago

@amrLLSE Could you provide the pubspec.yaml file instead of the deps command? It might show other causes for the problem.

davidmartos96 commented 1 week ago

@amrLLSE Also, is there any reason why you are running sqflite version 2.0.3 instead of the latest? With the latest version of sqflite you don't need to provide the override for sqlcipher.

You can do flutter pub upgrade sqflite to update the dependency in your .lock. Latest version is 2.3.3

amrLLSE commented 1 week ago

@davidmartos96 Unfortunately sharing any full file code from my project is against my company NDA, I hope you are understanding that 🙏 but sure I will assist you with anything I can do to resolve this issue. Can you explain more about that: (It might show other causes for the problem.) Causes like what?

I was just using latest sqflite but it produces the same issue, so I have tried this workaround. Now removed it and did flutter pub upgrade sqflite but the same issue happens.

davidmartos96 commented 1 week ago

@amrLLSE It was in case some other dependency is adding sqlcipher as well, causing conflicts. I would look for sqlcipher_flutter_libs in your .lock file, which is the other well known dependency for sqlcipher on flutter apps. https://pub.dev/packages/sqlcipher_flutter_libs/changelog

amrLLSE commented 1 week ago

@davidmartos96 Okay let me check that and get back to you.

davidmartos96 commented 1 week ago

@amrLLSE You can also try to reproduce the issue in the example app in the repository. It might take a few days until I can grab a macOS device to test the issue you are having. If you try it we can at least know if it's a problem in your project or in the package.

amrLLSE commented 1 week ago

@davidmartos96 No any other dependency is adding sqlcipher.

Okay I will try to reproduce using the example project and get back to you. Thanks so much for your understanding and support 🙏

amrLLSE commented 1 week ago

@davidmartos96 It is reproducible on the example project, just open ios module in XCode and archive, the same error appears instantly.

albrewot commented 1 week ago

Having the exact same error. Started happening after updating XCode to the latest version a couple days ago

davidmartos96 commented 1 week ago

@amrLLSE @albrewot We have been able to reproduce it, but we are not sure what the solution is. We were able to bypass the error by removing the SQLCipher dependency from the podspec in the ios/macos folder and only leaving FMDB/SQLCipher, which depends on SQLCipher transitively. The problem with this is that we lose control over which SQLCipher version gets pulled. Latest would always be used, which sometimes might require changes in the plugin before updating, so this is not a reliable solution.

If anyone has more context on why this happens PRs are welcome.

albrewot commented 1 week ago

@amrLLSE @albrewot We have been able to reproduce it, but we are not sure what the solution is. We were able to bypass the error by removing the SQLCipher dependency from the podspec in the ios/macos folder and only leaving FMDB/SQLCipher, which depends on SQLCipher transitively. The problem with this is that we lose control over which SQLCipher version gets pulled. Latest would always be used, which sometimes might require changes in the plugin before updating, so this is not a reliable solution.

If anyone has more context on why this happens PRs are welcome.

@davidmartos96 On another project i was using an older version of this package (^2.2.0), downgraded from latest (3.1.0+1) to (2.2.0) on the project with the error and was able to archive on XCode, although now i need to lookout for possible bugs because of the downgrade.

thanglq1 commented 16 hours ago

@amrLLSE @albrewot We have been able to reproduce it, but we are not sure what the solution is. We were able to bypass the error by removing the SQLCipher dependency from the podspec in the ios/macos folder and only leaving FMDB/SQLCipher, which depends on SQLCipher transitively. The problem with this is that we lose control over which SQLCipher version gets pulled. Latest would always be used, which sometimes might require changes in the plugin before updating, so this is not a reliable solution. If anyone has more context on why this happens PRs are welcome.

@davidmartos96 On another project i was using an older version of this package (^2.2.0), downgraded from latest (3.1.0+1) to (2.2.0) on the project with the error and was able to archive on XCode, although now i need to lookout for possible bugs because of the downgrade.

I'm facing the same issue. I need to downgrade to version 2.2.1 to archive it.