Problems get OBB File form GooglePlay Store

Hello everybody!

I´ve working for two Days on this Problem know, and dont get even closer. So I´m really appriciate if somebody could give me a hint. Thanks in advance!

In a nutshell: I have an apk thats bigger than 50MB I want to use OBB file + assetBundle to adress this problem. AssetBundle Loading is working if I copy the odd file with the right name in the right Folder. But if I try to get the OBB file from GooglePlay, I see: Download → Download finished, but I still dont get any data, and I´ve no idea why.

Whole Project can be found here: https://github.com/FriedrichWessel/TestOBB

Important Code: 

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic; 
    
    public class AssetStorage : MonoBehaviour {
    	
    	
    	public static AssetStorage Instance{
    		get; 
    		set; 
    	}
    	
    	//public string[] PrefabNames; 
    	public string prefab = "Penguin"; 
    	public string AssetBundleName; 
    	public string message = "NONE"; 
    	//private Dictionary<string, AssetBundleRequest> requests = new Dictionary<string, AssetBundleRequest>(); 
    	private AssetBundleRequest request; 
    	
    	private string mainPath; 
    	private string expPath; 
    	private WWW www;
    	
    	void Awake() {
        	DontDestroyOnLoad(gameObject);
    		
    		if(Instance == null)
    			Instance = this; 
    		
    	}
    	
    	void OnDestroy(){
    		//Instance = null; 
    		Debug.LogError("Destroy");
    	}
    	
    	
    	
    	// Use this for initialization
    	void Start () {
    		if(GooglePlayDownloader.RunningOnAndroid()){
    			expPath = GooglePlayDownloader.GetExpansionFilePath();
    			message = expPath; 
    			mainPath = string.Empty; 
    			if (expPath == null){
    				message = "External storage is not available!";
    				Debug.Log("External storage is not available!");
    			} else {
    				message = "Try get MainPath" ; 
    				Debug.Log(message);
    				mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    				Debug.Log("Main Path after first Fetch: " + mainPath);
    				message = "MainPath: " + mainPath; 
    			}
    			
    			if(mainPath == null){
    				message = "OBB not available - download!"; 
    				Debug.Log(message); 
    				GooglePlayDownloader.FetchOBB();
    				mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    				message = "OBB Fetch finished" + mainPath; 
    				Debug.Log(message); 
    			}
    		
    		}
    		StartCoroutine(Load()); 	
    		
    	}
    	
    	IEnumerator Load(){
    		
    		string filePath = string.Empty; 
    		if(GooglePlayDownloader.RunningOnAndroid()){	
    			bool testResourceLoaded = false;
    			int count = 0; 
    			while(!testResourceLoaded) { 	
    				
    				mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    				
    				//Debug.Log("Main Path after Fetch: " + mainPath);
    				if(mainPath != null){
    					testResourceLoaded = true; 
    					//Debug.Log("Found Main Path: " + mainPath);
    					break; 
    				}
    				count++; 
    				if(count > 60)
    					break; 
    				yield return new WaitForSeconds(0.5f); //Let's not constantly check, but give a buffer time to the loading
    
    	
    			}
    			
    			if(!testResourceLoaded){
    				message = "Connectionion Timeout"; 
    				Debug.Log(message); 
    			}
    				
    			else{
    				
    				message =  "Loading Finished";
    				Debug.Log(message); 
    			}
    
    	
    			if(mainPath == null){
    				message = "MainFile still not found!"; 
    				Debug.Log(message); 
    				
    			}
    		
    			filePath = "jar:file://" + mainPath;
    			filePath += "!/"+AssetBundleName+".unity3d";
    			
    			
    		
    		} else {
    			filePath = "file://" + Application.dataPath; 
    			filePath += "/"+AssetBundleName+".unity3d"; 
    			
    		}
    			
    		
    		
    		message = "FilePath: " + filePath; 
    		Debug.Log(message); 
    		
    		
    		www = WWW.LoadFromCacheOrDownload(filePath,0); 
    		yield return www;
    		var bundle = www.assetBundle; 
    		if(bundle == null)
    			Debug.Log("bundle == 0"); 
    		
    		Instantiate(bundle.Load(prefab, typeof(GameObject))); 
    
    	}
    	
    	public string InstancePrefab(string name){
    		/*if(requests.ContainsKey(name)){
    			Instantiate(requests[name].asset); 
    			return ("Finished loading: " + name); 
    		} else 
    			return ("Asset not found: " + name); */
    		//Instantiate(request.asset); 
    		
    		return ("Instance Finished: " + name ) ; 
    	}
    	
    	void OnGUI(){
    		GUI.Label(new Rect(10, 10, Screen.width-10, 20), message);
    	}
    	
    	
    	
    }

Thanks again !

Friedrich

P.S.: I get all the information from these links here:

Android Expansion Files:

Usage of the OBB Plugin
http://forum.unity3d.com/threads/150095-Split-APK-amp-Google-Play-OBB-Downloader-Question

Add License to the Google Play Account:

Looks like the Google Server need some time to update the files in some way. Yesterday I had a lot of problems (the one you described, but also others like “no file found” and similar), but checking it again today… everything just worked.

You don’t need the “Google Play Application License Verification” plugin! This is for additional licensing checks and has nothing to do with the expansion file plugin (GooglePlay OBB Downloader), which provide their own LVL.

One problem I had, was the english app name, which has to be equal in the GooglePlay Dev Console and in the app itself. I haven’t found this in the documentation (or just skipped it). :wink:

I had the same problem. In my case I was forgetting the CHECK_LICENSE permission in the manifest file.
Even if the application is free (and so no need to check the license), it seems that this permission is needed to download the expansion file.