Why code didn't work in android build (not editor)? Code (CSharp): using System.IO; using System.Text; using UnityEngine; public class Test : MonoBehaviour { private void Start() { string path = Path.Combine(Application.streamingAssetsPath, "file.txt"); Debug.Log("Path " + path); FileStream stream; try { stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); } catch (System.Exception ex) { Debug.LogError("Exception " + ex.Message); Debug.LogException(ex); throw ex; } Debug.Log("Opened!"); using (var reader = new StreamReader(stream, Encoding.UTF8)) { string result = reader.ReadToEnd(); Debug.Log(result); } } } file.txt placed in StreamingAssets with text "Hello, world" Code (csharp): Unity Output: Path jar:file:///data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt Exception Could not find a part of the path "/jar:file:/data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt". Logcat output 09-20 02:33:30.011 14847 14865 I Unity : Path jar:file:///data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt 09-20 02:33:30.011 14847 14865 I Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) 09-20 02:33:30.011 14847 14865 I Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) 09-20 02:33:30.011 14847 14865 I Unity : UnityEngine.Logger:Log(LogType, Object) 09-20 02:33:30.011 14847 14865 I Unity : UnityEngine.Debug:Log(Object) 09-20 02:33:30.011 14847 14865 I Unity : Test:Start() (at D:\Projects\bug_android_file\Assets\Test.cs:12) 09-20 02:33:30.011 14847 14865 I Unity : 09-20 02:33:30.011 14847 14865 I Unity : (Filename: D Line: 0) 09-20 02:33:30.011 14847 14865 I Unity : 09-20 02:33:30.026 14847 14865 E Unity : Exception Could not find a part of the path "/jar:file:/data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt". 09-20 02:33:30.026 14847 14865 E Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) 09-20 02:33:30.026 14847 14865 E Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) 09-20 02:33:30.026 14847 14865 E Unity : UnityEngine.Logger:Log(LogType, Object) 09-20 02:33:30.026 14847 14865 E Unity : UnityEngine.Debug:LogError(Object) 09-20 02:33:30.026 14847 14865 E Unity : Test:Start() (at D:\Projects\bug_android_file\Assets\Test.cs:21) 09-20 02:33:30.026 14847 14865 E Unity : 09-20 02:33:30.026 14847 14865 E Unity : (Filename: D Line: 0) 09-20 02:33:30.026 14847 14865 E Unity : 09-20 02:33:30.055 14847 14865 E Unity : DirectoryNotFoundException: Could not find a part of the path "/jar:file:/data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt". 09-20 02:33:30.055 14847 14865 E Unity : at 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) [0x0017d] in <c6bd535f6ab848b4a13f34d01b756eef>:0 09-20 02:33:30.055 14847 14865 E Unity : at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <c6bd535f6ab848b4a13f34d01b756eef>:0 09-20 02:33:30.055 14847 14865 E Unity : at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) 09-20 02:33:30.055 14847 14865 E Unity : at System.IO.File.Open (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <c6bd535f6ab848b4a13f34d01b756eef>:0 09-20 02:33:30.055 14847 14865 E Unity : at Test.Start () [0x00023] in D:\Projects\bug_android_file\Assets\Test.cs:17 09-20 02:33:30.055 14847 14865 E Unity : UnityEngine.DebugLogHandl 09-20 02:33:30.056 14847 14865 E Unity : DirectoryNotFoundException: Could not find a part of the path "/jar:file:/data/app/com.tn141.test-k9eUQRri9cUpPw2m2Pid3Q==/base.apk!/assets/file.txt". 09-20 02:33:30.056 14847 14865 E Unity : at Test.Start () [0x0004f] in D:\Projects\bug_android_file\Assets\Test.cs:23 09-20 02:33:30.056 14847 14865 E Unity : 09-20 02:33:30.056 14847 14865 E Unity : (Filename: D Line: 0) 09-20 02:33:30.056 14847 14865 E Unity :
From the documentation for streamingassets : Android uses files inside a compressed APK /JAR file, "jar:file://" + Application.dataPath + "!/assets". You probably need to 'download' those files with Www or UnityWebRequest rather than using File.Open