I am stuck at running unity3D android build in android device, it runs in editor but when I create an android build and try to run in my android device, I get errors in logcat like: no such file or directory
and No such table
when I try to access database through code, when checked my android file explorer I found database size is zero, which shouldn't be I guess.
I have kept database in StreamingAssets
folder, which is not empty.
This is my C# code to setup db:
#if !UNITY_EDITOR
var filepath = string.Format("{0}/{1}", Application.persistentDataPath, DatabaseName);
if (!File.Exists(filepath))
{
Utils.Log(LogType.Debug, "Database does not exist");
string DatabaseName = Constants.Settings.dbName;
#if UNITY_ANDROID
// open StreamingAssets directory and load the db ->
var filepath = string.Format("{0}/{1}", Application.persistentDataPath, DatabaseName);
var loadDb = new WWW("jar:file://" + Application.dataPath + "!/assets/" + DatabaseName);
while (!loadDb.isDone) { }
File.WriteAllBytes(filepath, loadDb.bytes);
#endif
}
Even I cannot see above log in logcat "Database does not exist", seems it never comes inside if block, but how come file already been existed in device's persistentDataPath.