Log in or register to post comments

Split binary - unable to find in extended root locations

November 2, 2015 - 2:24pm #1

Vuforia SDK Version: 5.0.6 -

Description with steps to reproduce:

Issue

It seems Vuforia is unable to load data set when application binary is split (APK+OBB)

Tracking works just fine as long as there is no binary split. If compiled with binary split, Vuforia seems unable to find the data set in extended root locations; and thus cannot be loaded or activated. Any way to work around this?

Versions : Using Vuforia 5.0.6 with Unity 5.2.2p1 for Android

Reproduce:

Empty project importing Vuforia 5.0.6 and a dataset.

Add a cube to display something on the target.

Run on android device without splitting binary =  works fine

Run on android device with splitting binary = error occurs.

-

Development OS (Mac OS X, Windows, Linux): Windows -

Mobile OS and Version: Android 4.4 -

Mobile Device Manufacturer and Model name: Sony Xperia Z1 Tabet -

Do the Vuforia Sample Applications show the same behavior?: Did not try a sample application, but a simple basic project shows the same issues
Basic project = New project with import of Vuforia 5.0.6 and a newly downloaded data set + a cube.

Split binary - unable to find in extended root locations

November 4, 2015 - 4:21am #8

Hi,  I have done this see the link I attached to the other thread on forum.

 

The videos etc are all there and visible but Vuforia cant find them but does find the videos but does find the dat and xml

 

really appreciate any help as this app was supposed to have gone live!!  and the split thing has scuppered me good and proper :-(

Split binary - unable to find in extended root locations

November 4, 2015 - 4:17am #7

Great progress about this:

 https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/dataset-does-not-exist-error-when-using-unity-4-android#comment-2059803

 

For the video files, if you use the Split Binary option (and your APK size is exceeding the 50MB), the video files should also be located in the OBB extension package; which means you should access them in a similar way as for the DAT and XML files.

 

 

Split binary - unable to find in extended root locations

November 4, 2015 - 3:55am #6

 see here: https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/dataset-does-not-exist-error-when-using-unity-4-android#comment-2059803

 

 

Hi,

 

yes extrenal SDCard is on and the copying is completed BEFORE the Vuforia scene loads.

 

Looking at VideoPlaybackBehaviour it has m_path which is read from the Editior which has always been just the file name.  So for Android does this mean I should amend to include full path?  But this is not necessary in single APK?

Split binary - unable to find in extended root locations

November 4, 2015 - 3:51am #5

Unity should abstract the actual path on your device file system, when using  Application.streamingAssetsPath or Application.persistentDataPath  , which means that the actual data path should be adjusted automatically.

One thing you may want to double-check is whether you have set the Write Access to External, in the Android Player Settings, as this will have an impact on the file path used by Unity.

Also, if you extract and then save the Dat and XML files in a coroutine (as shown in your previous code you posted), make sure you wait until the coroutine has completed its job before loading another scene, as the coroutine are running in background;  for example, you could set a boolean flag to true at the end of the coroutine, and check it beforee loading the new scene.

 

 

Split binary - unable to find in extended root locations

November 3, 2015 - 10:45am #4

further invesitgation shows the file paths are not as expected?

using the sample code to access the streaming assets files it is trying to copy the source xml and dat files from /assets/QCAR/MyApp.xml to

/storage/emulated/0/Android/data/.com.MyApp/files/QCAR/MyApp.xml (AKA android persistent storage)

But when I open the main apk as a zip file, it has an assets folder but QCAR is not inside it, hence the copy fails!

It actually needs to copy from the obb file/assets/QCAR/MyApp.xml which is where these files really reside. 

So Application.streamingAssetsPath + "/QCAR/MyApp.xml" is not getting the correct path?

If I manually copy the dat and xml files to /storage/emulated/0/Android/data/com.MyApp/files/QCAR/MyApp.xml the AR is triggered but on another phone this path does not exisit as it gets reported as /sdcard/Android/data/com.MyApp/files/QCAR/MyApp.xml

So the unity variable that is getting the storage path is incorrect/different on different devices. 

And another issue I now have is "OH NO!" I have some large videos in StreamingAssets as I am using the Vuforia Video playback package!  So does this mean I now have to copy all these movies also??  

Is there no way to tell vuforia to look directly in the obb for video files?  As if not this means the video assets sget doubled up on the users device?  Not to mention the slow down while they have to wait for them to copy over?

This has totally knobbled my app as not being an Android developer was using Unity and only found out about having to split the binary when putting it up to Google Play :-((

 

Thanks in advance...

 

 

Split binary - unable to find in extended root locations

November 3, 2015 - 8:44am #3

I have followed the instruction on the link you provided but I still do not get the dat or xml files loaded.  If I connect my device to Android Studio after installing app from beta on Google Play I see mesaages like:

Unable to find <app name> in extended root locations

 Dataset <app name> could not be loaded and cannot be activated.

In my code that runs on start before any AR Scene is loaded I do this:

public class CheckForFirstRunScript : MonoBehaviour {

	private string uriOfDatasetXMLInObb;  
	
	private string uriOfDatasetDATInObb;

	void Start () {
	
		#if UNITY_ANDROID

			uriOfDatasetXMLInObb = Application.streamingAssetsPath + "/QCAR/MyXML.xml"; 

			uriOfDatasetDATInObb = Application.streamingAssetsPath + "/QCAR/MyDAT.dat";

			StartCoroutine(GetDatasetXML());

			StartCoroutine(GetDatasetDAT());

		#endif

		// get the int value for first run state
		int hasRunOnce = PlayerPrefs.GetInt ("HasRunOnce");
		
		// and convert to bool
		bool isFirstRun = hasRunOnce == 0 ? false : true;

		// has the app run at least once
		if (!isFirstRun) {

			// let app know we did not load help scene from AR
			PlayerPrefs.SetInt ("LoadingHelpFromARScene",  0 );

			// set app first run state for next run so help will not auto display in future
			PlayerPrefs.SetInt ("HasRunOnce",  1);

			// open help scene on first run of app
			Application.LoadLevel("Help");
		}
	}

	private IEnumerator GetDatasetXML() {

		// make the call to the project url
		WWW www = new WWW (uriOfDatasetXMLInObb);
		
		// wait for response
		yield return www;

		if ( www.error == null || www.error == "") {

			File.WriteAllBytes(Application.persistentDataPath + "/QCAR/MyXML.xml", www.bytes );
		}
	}

	private IEnumerator GetDatasetDAT() {
		
		// make the call to the project url
		WWW www = new WWW (uriOfDatasetXMLInObb);
		
		// wait for response
		yield return www;

		if ( www.error == null || www.error == "") {

			File.WriteAllBytes(Application.persistentDataPath + "/QCAR/MyDat.dat", www.bytes );
		}
	}
}

Basically I don't have a clue about this as it works perfect with a single apk on computer but once split I get the known issue re locating files in the obb

It looks like the write is creating the correct destination folder but it has a folder named files which is empty.  It looks like the streamingAssest path is not working? 

 

Also, would the .xml and .dat exist in the stub apk like the first scene does?

 

Any help....please...

 

Split binary - unable to find in extended root locations

November 3, 2015 - 6:46am #2

This is not a bug; you can handle Android Apps whose size is larger than 50MB using the Split Binary option, but you'll need to follow these instructions:

https://developer.vuforia.com/forum/faq/unity-how-can-i-handle-large-android-apps

 

Log in or register to post comments