over17 / unityobbdownloader Goto Github PK
View Code? Open in Web Editor NEWThis is Unity plugin for Android, intended to download .obb expansion files from Google Play.
License: Apache License 2.0
This is Unity plugin for Android, intended to download .obb expansion files from Google Play.
License: Apache License 2.0
Google requires us to remove some seemingly unnecessary permissions from our app, including WRITE_EXTERNAL_STORAGE which is requested by your plugin.
Is this mandatory or the plugin should work without it?
Do we have to force installation to the internal storage if removed?
Thanks for the answers.
Hi,I have been struggling these days to modify UnityOBBDownloader. I need a different layout that's why I need to change it. I exported it to android studio and changed it. But now I do not know how to put it back to unity. In drawables I have put my logo. I tried to put project folder to unity plugins but do not work. I am stuck here.
So the modified one has some icon images in drawables
Hello,
I just installed the plugin, attached the example script provided to our splashcreen and filled the public key ("YOUR PUBLIC KEY HERE") with our public key. we created a split build with Unity 2018.4.24 and tried to test the downloader by installing only the apk.
The plugin properly display the fetch button but when we click it, we get the following error
07-16 16:52:54.347 31880 31902 E Unity : AndroidJavaException: java.lang.NoSuchFieldError: no "Ljava/lang/String;" field "BASE64_PUBLIC_KEY" in class "Lcom/unity3d/plugin/downloader/UnityDownloaderService;" or its superclasses 07-16 16:52:54.347 31880 31902 E Unity : java.lang.NoSuchFieldError: no "Ljava/lang/String;" field "BASE64_PUBLIC_KEY" in class "Lcom/unity3d/plugin/downloader/UnityDownloaderService;" or its superclasses 07-16 16:52:54.347 31880 31902 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 07-16 16:52:54.347 31880 31902 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0) 07-16 16:52:54.347 31880 31902 E Unity : at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:62) 07-16 16:52:54.347 31880 31902 E Unity : at android.os.MessageQueue.next(MessageQueue.java:405) 07-16 16:52:54.347 31880 31902 E Unity : at android.os.Looper.loop(Looper.java:174) 07-16 16:52:54.347 31880 31902 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32) 07-16 16:52:54.347 31880 31902 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 07-16 16:52:54.347 31880 31902 E Unity : at UnityEngine.AndroidJNISafe.GetStaticFieldID (System.IntPtr clazz, System.String name, System.String sig) [0x00000] in <00000000000000000000000000000000>:0 07-16 16:52:54.347 31880 31902 E Unity : at UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jcla
We are stuck here as we don't have any clue as why it doesn't work. Any idea what might cause the issue?
I would love if the project could allow external contribution for languages.
We use crowdin. They support open source (a bit constraining rules to setup but I think this project could be accepted).
Maybe you could set a project up and we could contribute the translations.
If you use 1 Unity project for Android & iOS, even if you don't include the scene to download Obb, the code will fail and your iOS project won't build.
The GooglePlayDownloader.cs needs #if UNITY_ANDROID around it to stop it building on iOS
http://forum.unity3d.com/threads/unityobbdownloader-issues-on-ios.326698/
Hi.
I'm observing some weird behaviour on devices running Android 6.0.
Our app is published on the Google Play Store. If we run it right after downloading and installing it from there Unity doesn't seem to find the obb file while the plugin returns a path. This cause our app to be stuck on the first loading screen.
I've searched around, and I'm not sure if this is related to the new permission system (#5). logcat doesn't show any error on that matter.
Strangely enough, after rebooting the device the problem is gone and the app runs without issue.
Is this really a permission issue?
We're using Unity 4.6.4f1 (a bug in later versions prevents us from upgrading)
Android 8.1
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2018.2.20f1
Device model : Xiaomi Redmi 6
Device fingerprint: xiaomi/cereus/cereus:8.1.0/O11019/V10.2.3.0.OCGMIXM:user/release-keys
Caused by
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3257)
at android.app.ActivityThread.-wrap17 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1722)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:176)
at android.app.ActivityThread.main (ActivityThread.java:6656)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
Caused by: java.lang.IllegalStateException:
at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1532)
at android.app.ContextImpl.startService (ContextImpl.java:1488)
at android.content.ContextWrapper.startService (ContextWrapper.java:660)
at android.content.ContextWrapper.startService (ContextWrapper.java:660)
at com.unity3d.plugin.downloader.c.j.a (Unknown Source:108)
at com.unity3d.plugin.downloader.c.j.a (Unknown Source:8)
at com.unity3d.plugin.downloader.UnityAlarmReceiver.onReceive (Unknown Source:2)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3250)
As per https://developer.android.com/google/play/expansion-files#Filename, it is possible to have a case where the OBB and app version codes are different to one another:
<expansion-version>
This is an integer that matches the version code of the APK with which the expansion is first associated (it matches the app's
android:versionCode
value).
"First" is emphasized because although the Play Console allows you to re-use an uploaded expansion file with a new APK, the expansion file's name does not change—it retains the version applied to it when you first uploaded the file.
When dealing with large expansion files, it is likely that app developers will want to reuse them, in order to avoid forcing unnecessary re-downloads of the same expansion content when an app update is published.
The underlying expansion file downloader library around which this plugin is based already supports this, as it queries the expected expansion file name(s) and checks for their existence on the file system in order to determine whether a download is required or not:
However, the C# implementation makes the assumption that the expansion files will have the same version number as the app:
UnityOBBDownloader/Assets/Scripts/GooglePlayDownloaderImpl.cs
Lines 119 to 127 in d77e66f
If the Java plugin were able to provide a means for the C# script to call a native method that performs the same check as DownloaderService, then expected expansion file names could be returned and their existence checked with File.Exists
.
Currently, you could always call IGooglePlayObbDownloader.FetchOBB
, rather than first checking if GetMainOBBPath
returns null
(as in DownloadObbExample
) and allow the native plugin to decide if a download is required, but then there's no easy way to check if/when the native plugin has finished downloading, because waiting for GetMainPath
to not be null
to indicate completion will result in an infinite wait, due to the version codes mismatch.
Hi,
I use the DownloadObbExample.cs in my game and in that debug I can see... "waiting mainPath", "downloading" and the finally "wwww error Request aborted". After this the game gets stuck and I can't release the build. In my android device OBB folder I can see that the OBB file has been successfully downloaded, but it won't work.
It worked before but after I updated to Unity 2017.2.0f3 something broke.
"Open GooglePlayDownloader.cs and replace the BASE64_PUBLIC_KEY"
This means anytime someone updates the plugin, it will overwrite their changes and break the project.
It would be better if GooglePlayDownloader has a .SetKey() function that you have to call before then calling Init(), so the code in the constructor now goes into Init(), but will only run if you've set the key value first, otherwise will log an error.
Would be much nicer :)
Is it possible to create an aar version of this plugin ?
Cause it's simplier to manage them and it seems to be the new standard with a lot of plugins.
See http://forum.unity3d.com/threads/www-loadfromcacheordownload-on-obb-fails-with-npe-in-java-layer.364197/ and http://stackoverflow.com/questions/33030933/android-6-0-open-failed-eacces-permission-denied
Main issue is that the OBBDownloader reuses the Google Play APK Expansion rev 3 which isn't Android 6.0 permission compatible.
Someone should take contact with Google to see if they are working on an updated version. See also https://code.google.com/p/android/issues/detail?id=183844
In new versions of android sdk/android studio there's no more "android update". Also ant is no longer bundled with the sdk tools. Any change of getting a update version for the latest unity/android setups? If you're worried about maintaining compatibility for older users, I recommend tagging the current master as version 1.0, then releasing a 2.0 for newer versions. Just make it clear in the README what version is for who.
i use this plugin for long time, it used to be fine, but recently, it does not work anymore, always show this notice: obb download failed because the resources could not be found. the only things changed maybe my unity version and beta to official on google.
Hello,
This plugin is quite useful and elegant on Unity, but it's 2019 now, Google gives Android 8.0 already.
It looks like that we cannot start background service anymore on Android, so is there a quick solution about it?
The issue is described more here:
https://stackoverflow.com/questions/53916327/google-play-obb-downloader-library-crashes-on-android-8-0
Thanks in advance!
The following error appears during project build.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unityLibrary:javaPreCompileRelease'.
> Could not resolve all files for configuration ':unityLibrary:releaseCompileClasspath'.
> Failed to transform artifact 'unityOBBDownloader.aar (:unityOBBDownloader:)' to match attributes {artifactType=android-classes, org.gradle.usage=java-api}.
> Execution failed for AarToClassTransform: C:\Users\PC\.gradle\caches\transforms-2\files-2.1\7d4fbbc0dd844aed72a5d0126e59d525\jetified-unityOBBDownloader.aar.
> entry
Removing gradle caches does not eliminate this error.
Error log:
11-30 03:54:30.975 1306-1317/? W/Binder: Caught a RuntimeException from the binder stub implementation.
11-30 03:54:30.975 1306-1317/? W/Binder: java.lang.NullPointerException
11-30 03:54:30.975 1306-1317/? W/Binder: at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
11-30 03:54:30.975 1306-1317/? W/Binder: at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
11-30 03:54:30.975 1306-1317/? W/Binder: at android.os.Binder.execTransact(Binder.java:404)
11-30 03:54:30.975 1306-1317/? W/Binder: at dalvik.system.NativeStart.run(Native Method)
Hello,
I have brought the downloader into my project. when I run it on android it downloads the obb file and then does not load to the second scene it hangs not loading anything.
I do some checks after the file is downloaded to make sure it is there and it say it is but it docent move to the next scene. Any help would be great or pointing into the right direction would be great
Hi I'm trying to use OBB with Unity 2019.3, I keep receiving a object null reference error in the public key section specified on the DownloadOBBExample. It happens when I attached to the main camera or game object....
m_obbDownloader.PublicKey = " "; // YOUR PUBLIC KEY HERE
I've tried creating a separate public string and then assigning it...
public string mykey;
(I assigned my actual key using the void Awake() method to load before the Start method)
m_obbDownloader.PublicKey = myKey;
I'm not sure why its causing this error....
hi,I have a problem. My English is not very good. google play Obb download error~
java.lang.IllegalArgumentException:
at com.unity3d.plugin.downloader.d.d.a (Unknown Source:44)
at com.unity3d.plugin.downloader.d.d. (Unknown Source:21)
at com.unity3d.plugin.downloader.c.m.run (Unknown Source:63)
at android.os.Handler.handleCallback (Handler.java:907)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:216)
at android.app.ActivityThread.main (ActivityThread.java:7625)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
Caused by: com.unity3d.plugin.downloader.e.b:
at com.unity3d.plugin.downloader.e.a.a (Unknown Source:175)
at com.unity3d.plugin.downloader.d.d.a (Unknown Source)
when my game enter background, then i click from service bar, or from home icon, the UnityDownloaderActivity finish self, but the service bar is exist, and the obb not finished.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.