I have a apk file called rise of kingdoms which is of 1.1GB and when i reverse engineer it there's no obb file and anbox has a limit to upload over 100MB file how can i do it i tried copying data in extra-data section but could help got an error of
Error extra data without an apk could not be installed
my manifest.yaml file looks like this
name: rise
instance-type: a4.3
watchdog:
disabled: true
required-permissions: ['*']
extra-data:
assets:
target: /sdcard/Andriod/data/com.lilithgame.roc.gp/
PLease help me to do this fix i want to slip this app to obb and apk and make installable .
Related
I have a quiz app with:
Video assets (over 1000 files, 750 MB) that can be downloaded using the download_assets package.
Image assets (also over 1000 files, 80 MB), bundled and deployed with the app.
Filenames are stored in a sqlite database.
I'm using Android Studio, macOS.
I wrote a function that takes filenames from a database and checks which files are on a device.
As it turned out, several of the video files are unavailable on Android devices (although they are visible in Device File Explorer). On iOS devices everything is OK.
Also some images are not available, but here on both iOS and Android devices.
I wrote Python script:
import os
import chardet
dir = '/path/to/directory/with/assets'
for n in os.listdir(dir):
if (chardet.detect(os.fsencode(n))['encoding'] != 'ascii'):
print ('{} => {} (confidence: {})'.format(n, chardet.detect(os.fsencode(n))['encoding'], chardet.detect(os.fsencode(n))['confidence']))
All files that work are encoded in ascii, the rest looks like this:
pięć5.mp4 => utf-8 (confidence: 0.7525)
JAZDA NOCĄorg.mp4 => ISO-8859-1 (confidence: 0.73)
Rowerzystę W17_2.mp4 => utf-8 (confidence: 0.505)
I tried renaming files in terminal. Then I tried to use the convmv utility. When I prepared a zip in terminal with only these 3 files it worked, but when I created a full archive, it turned out that two other files that worked fine before (and which had non-Latin characters in the name) stopped loading.
My final solution: I packed the two problem files in Finder (like the first archive). Then I added the rest of the files to the archive in the terminal:
zip assets.zip *.mp4
Now all video files load on both Android and iOS devices. But why?
I also solved the problem with the image files. I tried with mv and conmv in the terminal of course. I think it worked with at least one file (I'm not sure because I was in the dark and don't know what finally worked). I got stuck with a few files and that's when I found this link.
I used the Refactor->Rename option in Android Studio. I renamed the files to those that did not contain non-Latin characters (e.g. 313D12_a_org_światło.jpg to 313D12_a_org_swiatlo.jpg). I restarted the application. Then I renamed the files in Android Studio to the old ones. After restart all the files worked.
I am writing all this for two reasons:
Maybe someone will have similar problems and this description will be useful to him.
I am very curious what is causing this behavior. Especially, why files extracted from a zip will behave differently depending on how the zip is prepared and on which device it is used (Android or iOS).
I looked for solutions from many places (Test programmatically if in Android 10+ the legacy external storage access is disabled, https://developer.android.com/google/play/expansion-files.html#Downloading, etc.), but don't know the exact cause of the error.
If app is downloaded from Google Play only in case for android 10 devices, it gives this error:
Caused by: java.lang.IllegalArgumentException: Couldn't get OBB info for /storage/emulated/0/Android/obb/packageName/main.package_version.packageName.obb
The program can find the obb file (even on android 10 devices)
File mainFile = new File(Environment.getExternalStorageDirectory() + "/Android/obb/" + packageName + "/" + "main." + packageVersion + "." + packageName + ".obb")
mainFile.getAbsolutpath()
gets the file path too. However, when Storage Manager is used for app that is downloaded from Google Play store
sm.mountObb(mainFile.getAbsolutePath(), null, mainObbStateChangeListener );
it cannot reach obb expansion file and terminates app with above error.
App can be downloaded from Google Play, but works only for android 9 or below devices. If I create apk and install it on android 10 device, the app can reach obb file without any problem.
What do I miss to be able run app on android 10 devices when it is downloaded from Google Play store? Help would be appreciated.
Update:
I found the cause of the error on Android 10 device, though I still don't know the answer:
If the apk version code (the version code in app gradle) matches to the version code in the obb file name (which it should be if I understood well (https://developer.android.com/google/play/expansion-files), then in the obbexpansionmanager class, the line
sm.mountObb(mainFile.getAbsolutePath(), null, mainObbStateChangeListener );
throws this error:
Caused by: java.lang.IllegalArgumentException: Couldn't get OBB info for /storage/emulated/0/Android/obb/packageName/main.package_version.packageName.obb.
If I change the downloaded app's obb file to a different version code (tested with version code 8, 1, 10 when apk's version code was 9) then app starts and above error does not come up. However, I cannot use different version code in the obb file's name other than the apk's version code to be able to download apk with obb from Google Play store. Furthermore, the media files cannot be reached from obb file unless it matches version codes.
If the device is under Android 10 then app works with same version code in apk and in obb expansion file.
A substitute method can be used instead of Environment.getExternalStorageDirectory() which is Context.getObbDir() which will return the full path of the OBB directory meant for the running application, i.e.: /storage/emulated/0/Android/obb/packageName.
This can replace the code part Environment.getExternalStorageDirectory() + "/Android/obb/" + packageName. More details of this method can be found here.
This code works in the simulator but not on my Android device:
local path = system.pathForFile("chinese_rules.db")
print("PATH:: " .. tostring( path ) )
When I run this code on my Galaxy S4 path returns nil.
My first thought was that it was some typo (case sensitivity) but I can't find any typo:
http://i59.tinypic.com/wlpu14.png
I can't find any reason why it should receive nil. This causes a problem as I can't load my database.
I have also tried this with the same result:
local path = system.pathForFile("chinese_rules.db", system.ResourceDirectory)
I have been able to load a path and load databases like this before.
Corona Build: 2013.2100 (2013.12.7)
Further reading the documentation I don't see that .db is a restricted file type:
Corona allows direct loading of images and audio files using the
appropriate APIs, but it has limited access to resource files on
Android using the file I/O APIs. Specifically, the following types can
not be read from the resources directory: .html, .htm., .3gp, .m4v,
.mp4,.png, .jpg, and .ttf.
http://docs.coronalabs.com/api/library/system/pathForFile.html
I found out the reason for the problem:
We are two that are working on this project and he had setup to use expansion files so two files was created (the main APK and the OBB expansion file) which I didn't notice and I only loaded the main APK file and I guess the database is in the OBB file. After setting not to use an expansion file the app works.
usesExpansionFile = false
I'm trying to test the Expansion Pack Files (OBB) In Android following the guide here:
http://developer.android.com/google/play/expansion-files.html
I'm in the step where I need to test my app on my Nexus 4.
I generated my .obb file with jobb and adb-pushed it in the device in this location:
/mnt/shell/emulated/0/Android/obb/my.package/main.1.my.package.obb
When the app run it doesn't find the file.
Method:
Helpers.doesFileExist(context, fileName, xf.mFileSize, false)
return false for my file.
I debugged and found out it is looking for the file in:
/storage/emulated/0/Android/obb/my.package/main.1.my.package.obb
Specifically this is the path returned by:
Helpers.generateSaveFileName(c, fileName)
The /storage/emulated/0, returned by Environment.getExternalStorageDirectory() doesn't exist browsing the device with adb shell.
But it DOES at runtime, inside the app, I also checked what it contains: it contains almost the same things I found in /mnt/shell/emulated/0, it contains the Android/obb dir, which is empty.
How I found out the path /mnt/shell/emulated/0/Android/obb/my.package/main.1.my.package.obb where I placed my obb file:
$ adb shell
$ ls -ld sdcard
lrwxrwxrwx root root 2013-10-16 17:34 sdcard -> /storage/emulated/legacy
$ ls -ld /storage/emulated/legacy
lrwxrwxrwx root root 2013-10-16 17:34 legacy -> /mnt/shell/emulated/0
And inside that I already found the Android/obb directory, empty.
So the question is: where should I put my obb file for it to be in the right position at runtime?
I did everything said there:
created a draft application in the Market to get the public key
generated a random array of 20 byte (salt)
integrated play_licensing/library and play_apk_expansion/download_library
wrote my Service / Receiver
did the check using the Helpers etc.. exactly like the documentation say.
I suppose everything works but I can't just yet release on Play Store! I need to test locally and I'll have the need to change my obb file pretty often in this initial phase of development.
I can't test on the Emulator because I use 3D and device camera.
Since Android 4.2 multi users support have been added.
To support that Android mount an emulated disk for each users acting as a sandbox layer around the actual filesystem: this let Android handle gracefully either sharing of files between users either personal files.
Long story short:
/storage/emulated
is the emulated filesystem.
if you enter that directory from adb shell you may see a
/storage/emulated/obb
directory. Sometimes it doesn't show up, for some reason (see below for what to do if this happen)
It's not in /Android/obb but that's the right directory where to place your app package / obb file!
If you don't see that directory try looking in:
/mnt/shell/emulated/obb
You should be able to put your file there.
It will be correctly picked up at runtime ending at the
/storage/emulated/0/Android/obb/my.package/main.1.my.package.obb
path.
I think the Android documentation should explain this.
(I answer my own question because I found out how to solve it while writing it.)
For me the correct location is : mnt/sdcard/Android/obb/nameofyourpackage/
NOT "/mnt/shell"
An Air app which loading data from an external XML file (cfg.xml). I've published the Android/Air file, included the cfg.xml file in the Android package. Then I've installed on my SD Card(). App's reading xml file - working perfectly. But I need raw access(on my device) to cfg.xml I cannot find this file, checked everywhere(Rooted Phone). Where is it? Is there other solution? I need a file which is easy to read/write.
Use DDMS -> File Explorer and look for you app name in folders like data, ...
Solution:
Use fileStream instead of URLLoader
Change directory to SD Card e.g.
File.userDirectory.resolvePath("YourAppData/cfg.xml")
(No rooted phone needed)