If your manifest set the sdk target to API 21, both the official Google Play OBB Downloader Plugin from Unity and the License checker trigger the same Fatal exception on Lollipop.
We fixed that by making the intent calls explicit instead of implicit (adding intent.setPackage(“com.android.vending”) for each intents) in the source code of both plugin (available on asset store) and by recompiling the .jar . But it’s a long time I did not do android development and an official solution would be more than welcome !
It seems that the plugin does not work on Lollipop if it is built with unity 4.6.2f1 .
Apparently, the change of static value BASE64_PUBLIC_KEY in native code does not work properly from C#. The value decoded is still “REPLACE THIS WITH YOUR PUBLIC KEY - DONE FROM C#”.
Nothing has to be changed in the plugin code additionally. The crash happens because of some security improvements in Lollipop. You can grab the updated code from Github, or wait until the updated package on the Asset Store gets approved… (should be really soon)
Hi guys ,
I still have the same issue in lollipop.I downloaded the unity package from asset store.Everything worked well in Other versions of android but in lollipop my game(Downloader Scene) is crashing as soon as i launch the game.I am using unity 4.6.f1 and attached is the code to download obb
using UnityEngine;
using System.Collections;
public class DownloadObb : MonoBehaviour
{
private string expPath;
private string logtxt;
private bool alreadyLogged = false;
private string nextScene = "MainMenuTest_1";
private bool downloadStarted;
void Awake()
{
}
void log( string t )
{
logtxt += t + "\n";
print("MYLOG " + t);
}
void OnGUI()
{
//GUI.skin = mySkin;
//GUI.DrawTexture(new Rect(0,0,background.width,background.height),background);
if (!GooglePlayDownloader.RunningOnAndroid())
{
GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Use GooglePlayDownloader only on Android device!");
return;
}
expPath = GooglePlayDownloader.GetExpansionFilePath();
if (expPath == null)
{
GUI.Label(new Rect(10, 10, Screen.width-10, 20), "External storage is not available!");
}
else
{
string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);
if( alreadyLogged == false )
{
alreadyLogged = true;
log( "expPath = " + expPath );
log( "Main = " + mainPath );
log( "Main = " + mainPath.Substring(expPath.Length));
if (mainPath != null)
StartCoroutine(loadLevel());
}
//GUI.Label(new Rect(10, 10, Screen.width-10, Screen.height-10), logtxt );
if (mainPath == null)
{
GUI.Label(new Rect(Screen.width-600, Screen.height-230, 430, 60), "The game needs to download xxx of game content. It's recommanded to use WIFI connexion.");
if (GUI.Button(new Rect(Screen.width-500, Screen.height-170, 250, 60), "Start Download !"))
{
GooglePlayDownloader.FetchOBB();
StartCoroutine(loadLevel());
}
}
}
}
protected IEnumerator loadLevel()
{
string mainPath;
do
{
yield return new WaitForSeconds(0.5f);
mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
log("waiting mainPath "+mainPath);
}
while( mainPath == null);
if( downloadStarted == false )
{
downloadStarted = true;
string uri = "file://" + mainPath;
log("downloading " + uri);
WWW www = WWW.LoadFromCacheOrDownload(uri , 0);
// Wait for download to complete
yield return www;
if (www.error != null)
{
log ("wwww error " + www.error);
}
else
{
Application.LoadLevel(nextScene);
}
}
}
}
Please Point me in right direction.
Note : my Androidmaifest.xml has
“”
and installing it on lolliop.Will this creates this issue???
First of all, you should share your error message from logcat.
Then, in your Android SDK Manager, install latest build-tools, platform-tools and SDK Platform 21.
Finally, update your Unity version to the latest available (you are either using original 4.6 release or missing minor version number).