Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Google Play OBB Downloader Plugin crashes on Lollipop

Discussion in 'Android' started by van_ustwo, Jan 13, 2015.

  1. van_ustwo

    van_ustwo

    Joined:
    Jul 10, 2012
    Posts:
    81
    I'm using the official Google Play OBB Downloader Plugin from Unity.

    The game crashes when calling GooglePlayDownloader.FetchOBB (); on Lollipop devices.
    Will there be an update to this plugin?

    Log

    01-13 14:48:00.545: E/AndroidRuntime(11281): FATAL EXCEPTION: main
    01-13 14:48:00.545: E/AndroidRuntime(11281): java.lang.Error: FATAL EXCEPTION [main]
    01-13 14:48:00.545: E/AndroidRuntime(11281): Unity version : 4.6.1p2
    01-13 14:48:00.545: E/AndroidRuntime(11281): Device model : samsung Nexus 10
    01-13 14:48:00.545: E/AndroidRuntime(11281): Device fingerprint: google/mantaray/manta:5.0.1/LRX22C/1602158:user/release-keys
    01-13 14:48:00.545: E/AndroidRuntime(11281): Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.app.ContextImpl.bindService(ContextImpl.java:1751)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at com.unity3d.plugin.downloader.c.j.a(Unknown Source)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at com.unity3d.plugin.downloader.b.s.run(Unknown Source)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.os.Handler.handleCallback(Handler.java:739)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.os.Handler.dispatchMessage(Handler.java:95)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.os.Looper.loop(Looper.java:135)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at android.app.ActivityThread.main(ActivityThread.java:5221)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at java.lang.reflect.Method.invoke(Native Method)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at java.lang.reflect.Method.invoke(Method.java:372)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    01-13 14:48:00.545: E/AndroidRuntime(11281): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     
  2. tgouala-wellfiredLtd

    tgouala-wellfiredLtd

    Joined:
    Jun 8, 2013
    Posts:
    99
    Hi,

    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 !
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,129
  4. tgouala-wellfiredLtd

    tgouala-wellfiredLtd

    Joined:
    Jun 8, 2013
    Posts:
    99
    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#".

    upload_2015-2-10_11-47-51.png

    Was working previously with unity 4.6.0 though...
     
  5. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,129
    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)
     
  6. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    122
    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
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class DownloadObb : MonoBehaviour
    4. {
    5.     private string expPath;
    6.     private string logtxt;
    7.     private bool alreadyLogged = false;
    8.     private string nextScene = "MainMenuTest_1";
    9.     private bool downloadStarted;
    10.  
    11.  
    12.     void Awake()
    13.     {
    14.        
    15.  
    16.     }
    17.  
    18.     void log( string t )
    19.     {
    20.         logtxt += t + "\n";
    21.         print("MYLOG " + t);
    22.     }
    23.     void OnGUI()
    24.     {
    25.         //GUI.skin = mySkin;
    26.         //GUI.DrawTexture(new Rect(0,0,background.width,background.height),background);
    27.      
    28.         if (!GooglePlayDownloader.RunningOnAndroid())
    29.         {
    30.             GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Use GooglePlayDownloader only on Android device!");
    31.             return;
    32.         }
    33.      
    34.         expPath = GooglePlayDownloader.GetExpansionFilePath();
    35.         if (expPath == null)
    36.         {
    37.             GUI.Label(new Rect(10, 10, Screen.width-10, 20), "External storage is not available!");
    38.         }
    39.         else
    40.         {
    41.             string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
    42.             string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);
    43.             if( alreadyLogged == false )
    44.             {
    45.                 alreadyLogged = true;
    46.                 log( "expPath = "  + expPath );
    47.                 log( "Main = "  + mainPath );
    48.                 log( "Main = " + mainPath.Substring(expPath.Length));
    49.              
    50.                 if (mainPath != null)
    51.                     StartCoroutine(loadLevel());
    52.              
    53.             }
    54.             //GUI.Label(new Rect(10, 10, Screen.width-10, Screen.height-10), logtxt );
    55.          
    56.             if (mainPath == null)
    57.             {
    58.                 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.");
    59.                 if (GUI.Button(new Rect(Screen.width-500, Screen.height-170, 250, 60), "Start Download !"))
    60.                 {
    61.                     GooglePlayDownloader.FetchOBB();
    62.                     StartCoroutine(loadLevel());
    63.                  
    64.                 }
    65.             }
    66.          
    67.         }
    68.      
    69.     }
    70.     protected IEnumerator loadLevel()
    71.     {
    72.         string mainPath;
    73.         do
    74.         {
    75.             yield return new WaitForSeconds(0.5f);
    76.             mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);  
    77.             log("waiting mainPath "+mainPath);
    78.         }
    79.         while( mainPath == null);
    80.      
    81.         if( downloadStarted == false )
    82.         {
    83.             downloadStarted = true;
    84.          
    85.             string uri = "file://" + mainPath;
    86.             log("downloading " + uri);
    87.             WWW www = WWW.LoadFromCacheOrDownload(uri , 0);      
    88.          
    89.             // Wait for download to complete
    90.             yield return www;
    91.          
    92.             if (www.error != null)
    93.             {
    94.                 log ("wwww error " + www.error);
    95.             }
    96.             else
    97.             {
    98.                 Application.LoadLevel(nextScene);
    99.             }
    100.         }
    101.     }
    102.  
    103. }
    Please Point me in right direction.
    Note : my Androidmaifest.xml has
    "<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />"
    and installing it on lolliop.Will this creates this issue???
     
  7. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,129
    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).
     
unityunity