Multiple resources in target 'AppModule'

I have added a .mlmodelc in my swift playground.

And I am facing 2 errors:

"multiple resources named 'metadata.json' in target 'AppModule'. "

and

"multiple resources named 'coremldata.bin' in target 'AppModule' "

How can I resolve this?

Having the same problem did you fix that

I faced the same error, try adding the .mlmodel file instead of .mlmodec. It worked for me

You can try removing duplicate files with same name just remove it and rebuild the project (might work)

It is likely due to a naming conflict arising from the accidental duplication of files or incorrect project settings.

To resolve this issue, it is recommended that you take several steps:

  • First, verify whether there are any duplicate files with the same name in the project directory, and if so, delete the duplicate files.

  • Second, clean your project and try building it again. This will remove any old build artifacts before the next build. Go to Product > Clean Build Folder in Xcode, and then try building your project again.

  • Next, verifying that the correct file is referenced in the project settings is essential. Precisely, navigate to the Build Phases > Copy Bundle Resources and ensure that the proper "coremldata.bin" file is being copied to your app bundle.

    • You can find the Build Phases > Copy Bundle Resources in Xcode by following these steps:
      • Open your project in Xcode.
      • Select your project in the project navigator (the left-hand sidebar).
      • Select your app's target in the Targets list.
      • Click on the Build Phases tab.
      • The Copy Bundle Resources phase should be visible. Click on the disclosure triangle to expand it.
      Here, you can see the list of files that are included in your app's bundle. Look for the "coremldata.bin" and "metadata.json" files and verify that it is the correct file. If you don't see the "coremldata.bin" and "metadata.json" files in the list, you can add it by clicking the "+" button at the bottom of the list and selecting the file from the file chooser dialog.
  • Finally, checking for case sensitivity in your file names is essential, especially if using a version control system like Git. Ensure the file name is correct in your file system and Xcode project.

Should these steps fail to resolve the issue, you may need to provide more information about your project configuration.

I hope this information has been helpful to you.

Multiple resources in target 'AppModule'
 
 
Q