Apk not detect an obb unity - android

I didn't find any clear documentation on obb, so I decided to contact here. In general, the apk does not detect an obb file on android. The file is located in the right directory, the apk itself runs normally.
As far as I understand, I don't need to do anything extra with obb in the code and just put it in obb/packagename. Maybe I'm wrong, so I really look forward to your help
upd. Maybe I need to do something in the code? I just put the obb in the right directory and nothing else.

Here is the trick:
step 1. create a folder as same as package name
step 2. copy the obb file into that folder
step 3. rename the obb file to main.BundleVersionCode.packagename.obb
step 4. copy the folder to your Android Phone directory: Android/obb/, or try to copy the folder to sdcard/Android/obb/ if you have external sd card.
Then now you should be able to install the apk.

Related

Does Android automatically delete obb expansion files after install?

I have an obb file which is a zip file, which I unpack after downloading it in the obb folder. Then I copy the unpacked obb files to Internal Storage.
I just released an app to Internal testing. I installed the app, but I was hoping that the obb files would be automatically deleted, but it seems they are still hanging in there, and when I check the Storage size in Settings, the size of the apk file includes the data in the obb folder. I don't want this, because my app is taking less storage then it's actually showing in Settings / Storage.
Is there an Android process that automatic removes the obb files later on, or do I need to delete them myself when I don't need them anymore, right after copying them to internal storage?
The answer is no. The only time the OBB file gets deleted is when the user uninstalls the app. Or when the app deletes the file itself.
On a side note, which I happened to find out only later, if you delete or rename your OBB file, it gets re-downloaded every time you release an app update. So you are better off using the OBB file as is and leave it there as originally installed, and using a second OBB file for updates (your listed app size will include the OBB file though), or another option is using a file hosting service such as Dropbox if you don't want the OBB file just sitting there.

Android - how to remove Expansion files?

I followed this guide for download expansion files. When I checked it, the download worked fine, but when I wanted to uninstall the application from the phone the files stayed there.
How can I cause the files to be deleted with the app?
Downloaded expansion file(s) will be stored in your shared-storage folder (usually this is your sd-card). There is no code that can be triggered when uninstalling your application. This unfortunately means that you cannot remove expansion files from code when uninstalling the application.
However I did find out that on my Nexus 4 but also on a Samsung Galaxy S the expansion file is automatically deleted from the shared-storage folder when uninstalling the application. I tested this using an application that is in the play store.
When the expansion file is not deleted automatically then the only way to get rid of your expansion files after an uninstall would be to manually delete the file(s) from your shared-storage folder. An end-user can be instructed to remove the expansion file manually by letting him/her attach the device to the computer and navigate to:
<shared-storage>/Android/obb
In this folder you should see one or more folders with package names. Pick the folder that will contain your expansion file and delete the package folder or the expansion file depending on what you wish to be deleted. Be aware that deleting the wrong package can affect different apps. So use manual deletion with caution!
Some reasons why an expansion can't be deleted by end-user:
End-user doesn't have drivers for the device so it can't see what's on the shared-storage
End-user uninstalled the application and the expansion file is already gone
Store your app files in the Applications private directory.
This can be obtained with getFilesDir()
When your application is uninstalled, all files in this directory get deleted.

Convert apk into zip flashable in clockWorkMod?

How can i convert an apk into a zip flashable in clockWorkMod?
I tried using ApkInstaller. It didn't work. Keep getting the error; "installation aborted".
You can just change the .apk extension of your app to .zip Then put the .zip in your SD card and see if you can flashed with CWM.
I don't know exactly what you want to do, so if you can specify more info that would be great.
If what you want is to simply install an app (.apk) into your phone then you can follow this tutorial.

store file tree in .apk

How can I store a normal tree of files inside an Android .apk without all the weirdness of the Ressource or Asset concepts? It seems I have to do some akward thing to use Files from current path like any non-Android Java application do?
"use Files from current path" and "store... inside an Android .apk file" have nothing to do with each other.
Since, statistically speaking, you are likely familiar with Windows, let's draw some analogies.
"store... inside an Android .apk file" on Windows would be "store... inside a Windows .exe file". This is reasonably uncommon on Windows, at least the last I checked.
"use Files from current path" on Windows would refer to files that perhaps exist in the app's Program Files directory or the equivalent. On Android, this works fairly conventionally -- use getFilesDir() and Java file I/O.
What exists in Windows and does not exist in Android is the concept of packaging files to be installed at install time via an installer package, such as a .msi file.
Since you declined to tell us what the "normal tree of files" is and why you think it should be "inside an Android .apk", it is impossible to give you advice on how to avoid whatever "weirdness" you think exist in the "Ressource [sic] or Asset concepts". All I can tell you is that the equivalent on other OSes to bake files into the executable would likely be similarly "weird".
Okay, I haven't tested this, but a solution could be to add extra files to the APK before signing. You could automate this from the command line:
$ ant release
$ zip -r bin/MyApp-unsigned.apk <custom_folder>
$ jarsigner -verbose -keystore <keystore> -storepass <password> bin/MyApp-unsigned.apk <alias>
$ zipalign -v 4 bin/MyApp-unsigned.apk bin/MyApp-signed.apk
And then, in your activity, open the APK with ZipFile to access your custom folder:
ZipFile apk = new ZipFile(getApplicationInfo().sourceDir);
I'm not sure how the Android Market would react to this non-standard APK though.
With assets you can have a file tree in an APK, which can be accessed by using the AssetManager returned by getAssets().
The whole point of this mechanism is saving space. The files are not extracted to the file system when the app gets installed. When you read the content of an asset, it is uncompressed (unzipped) on the fly from the APK. It does make sense. Saving space is important on Android devices.
But nothing forbids you to extract the assets tree into the file system when your application is first launched, if you need that.
One approach that might work for you is to open the APK using ZipFile and ZipEntry, as this gives you access very similar to a conventional read-only directory structure.
Alternatively, you may be able to use getResourceAsStream to work with a traditional file structure - you might find this bug report useful if you go with this approach - it shows some perils of working with getResourceAsStream on android.
I should add that you shouldn't think of an APK as something gets extracted - files inside the APK are not on the filesystem, they're like resources inside a JAR file in a J2ME or J2SE environment (or the WAR/EAR for J2EE).
Hope this helps,
Phil Lello

Do music files on /sdcard go into apk?

I have an application that has been exported to an apk. I have stored some .wav music files on /sdcard/audio that are absolutely essential to the application. My question is this:
How do I export the wav files and make sure that they are present on the apk? When I export the project, the size of the apk is something like 23kB. It seems that I should have had the wav files somewhere else, in some other directory. I had added the files to /sdcard/audio by using mkdir + push commands in the adb.
Those type of files should be in /res/raw.
Files in the sdcard will not be pushed into the apk.
Assuming you had the .wav files on your virtual machine: it is essential you understand that this virutal machine had nothing to do with your apk. All the settings, downloads, uploads (like your wav) etc on this machine are just testing.
You could delete it and nothing really matters. Only your code in your project (if you're using eclipse: the code you see there, so your src, res etc dir's) will go in the apk. NOTHING from the emulator.
Now put them in a folder in your project like #macarse says: /res/raw

Categories

Resources