asmadsen / react-native-unity-view

MIT License
203 stars 129 forks source link

FileNotFoundException and nothing exported #55

Open CurralesDragon opened 3 years ago

CurralesDragon commented 3 years ago

Hello!

I'v been using this package for some time, but recently upgraded unity to version 2020 as it was the only way to fix a Unity bug.

But now when exporting android, I receive the error message:

FileNotFoundException: Could not find file "/Users/bla/src/c/packages/c-native/android/UnityExport/build.gradle"
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
(wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.StreamReader..ctor (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
(wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string)
System.IO.File.ReadAllText (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Build.DoBuildAndroid (System.String buildPath) (at Assets/Scripts/Editor/Build.cs:64)
Build.DoBuildAndroidLibrary () (at Assets/Scripts/Editor/Build.cs:25)

Is this error causing the export to fail or is the error appearing because nothing is exported (there's noting in the UnityExport folder)

srepollock commented 2 years ago

@nicwhitts did you run the React Native export from within Unity?

Arnaod commented 2 years ago

Hey, I'm having the same issue, any update @nicwhitts ?

CurralesDragon commented 2 years ago

Let me try and remember what happened here. Iv been using it again successfully.

CurralesDragon commented 2 years ago

Post your Build.cs script and il take a look

CurralesDragon commented 2 years ago

Actually, it could of been this fix in build.gradle:

flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }

Changing to unityLibrary instead of unityExport

There may be some other places I had to change this if i remember correctly. But maybe not! Let me know

Arnaod commented 2 years ago

Hi, thank you for your answers.

So far I changed it in the build.gradle :

include ":unityLibrary" project(":unityLibrary").projectDir = file("./UnityExport")

As well as settings.gradle:

flatDir { dirs "${project(':unityLibrary').projectDir}/libs" }

But still, I need to check "Export Project" for my build to work.

bll-manapulian commented 2 years ago

Hi, @nicwhitts , or @Arnaod have you made it work already? I've tried Arnaod's changes but no luck