rive-react-native icon indicating copy to clipboard operation
rive-react-native copied to clipboard

File resource not found. You must provide correct url or resourceName

Open mourice38 opened this issue 2 years ago • 7 comments

reseorce

hello, when I give it from resource url from internet, it works. If I give it from resourceName .riv file in project, I get the following error. I couldnt import riv file in project. When coding React native cli android on windows, I get this error. How i resolve this

mourice38 avatar Jul 12 '22 00:07 mourice38

@mourice38 Try integrating it into the androids/ios projects respectively as native assets there, then referencing just the resource name "foo.riv" for example, on this attribute.

zplata avatar Jul 20 '22 22:07 zplata

@zplata , did you have any example on how to put it as native assets and use it on react-native?

MrHazimAli avatar Aug 23 '22 11:08 MrHazimAli

@MrHazimAli We can add a page in our docs around how to add these assets to android/iOS! I'll update here with that link. Otherwise if you want to check out something in code, you can check out the example/ project's respective iOS xcodeproj and the Android project as well to see how Rive files were added there.

zplata avatar Aug 25 '22 15:08 zplata

Put up a resource page here: https://help.rive.app/runtimes/overview/react-native/loading-in-rive-files

Hope this helps!

zplata avatar Aug 26 '22 19:08 zplata

Thanks, zplata. I love Rive, and I think it's way much better than Lottie, but the docs for React Native, seriously guys, you need to gussy up this doc for RN (RN is a huge community).

hadnet avatar Aug 30 '22 19:08 hadnet

@hadnet Glad to hear you enjoy using Rive! We're definitely working to improve documentation to make it super easy to get started, while ensuring we have all our API's up-to-date and clarified. If you find anything misleading or missing, definitely invite you to log another issue here and we'll try and get things fixed up as soon as we can!

zplata avatar Sep 08 '22 20:09 zplata

@zplata Our React Native bundle is generated separately with Rive assets and then, at build time, brought into iOS build phase. How can I do the same thing that is being done through the UI to add .riv. files?

I have tried a ruby script using xcodeproj:

require 'xcodeproj'

def create_rive_asset_group_in_xcode(group_name)
  $project.main_group.find_subpath(group_name, true)
end

pbxproj_file_path = ARGV[0]
rive_assets_dir = ARGV[1]

group_name = 'RiveAssets'
$project = Xcodeproj::Project.open(pbxproj_file_path)

create_rive_asset_group_in_xcode(group_name)
Dir.glob("#{rive_assets_dir}/**/*") do |rive_file|
  file_reference = $project.main_group[group_name].new_file(rive_file)
  # also tried but this also copies the files instead adding reference
  #main_target.add_file_references([i])
  puts "Added file reference for #{rive_file}"
end

$project.save(pbxproj_file_path)

This code just copies the file unde RiveAssets group but reference is not added. These .riv show up under RiveAssets group but are shown in red - meaning they are not referenced?

Thanks!

kiranjd8 avatar Apr 23 '24 16:04 kiranjd8