File Picker without caching Files in flutter - android

I want to pick files from storage using flutter, but in all libraries the picked file writes to cache immediately and returns the cached URL (/data/data/package/cache...). Sometimes it's OK, but in case of multiple files and large sized files this is not acceptable. I have tried with image_picker,file_picker etc. Is there anything I am missing or any other libraries that can satisfy my requirement? This is happening while testing in android. I didn't test with iOS.

Use clearTemporaryFiles() method or pick files library below 2.0.0. From version 2.0.0 every file is cached on Android platform.

Related

Create Multidex Application with Adobe Flash Builder

I have an Actionscript Mobile project that I'm working on in flash builder 4.7 with quite a few ANEs included. The most recent one has pushed us over the 65k method reference limit. I can't find a way to properly include or implement the multidex support library with the app. Has anyone ever done this with flash builder before?
I would recommend to try dynamically load second dex file at application start and then load classes at runtime via Java-Reflection:
Take a look at these resources:
Post on Android Developers Blog
Sample Project
Be sure that after packaging AIR application your jar library is placed in assets folder. You can unzip apk in any case and check that it's located where it must be. Also, dex file must be named classes.dex.
*For Android 4.x.x DexClassLoader can read only files with .jar extension.

Issue with Android library Plugin .js files in res/raw after upgrading to Unity 5

I am using an Android Unity plugin for a library which followed the prior Unity 5 suggested structure and it was working perfectly. The package was placing the necessary files under Assets/Plugins/Android where the jar file existed and in folder Assets/Plugins/Android/res/raw some .js and .css files used by the library. Everything was working perfectly but when upgraded to Unity 5 hundreds of errors appeared regarding the .js and .css files. (like insert semicolon at a specific line, or expected token at that line etc.)
I am aware of the changes in Unity 5, especially as mentioned here: http://docs.unity3d.com/Manual/PluginInspector.html , however I cannot find a proper solution to resolve this. So what i think the issue is that Unity is trying to parse these files as something different most probably as c# files resulting to the errors. How can exclude files in Assets/Plugins/Android/res/raw from that procedure, or at least how can i handle this situation. Do i have to restructure the file hierarchy with the new Unity 5? As far as I read they can keep the same structure for backwards compatibility.
We've got a similar issue on one of our projects, and there seems to be no way of preventing unity (at least, to try) to compile all your scripts. At this point unity expects the .js files to be "unity script files" and tries to compile them, which of then fails, when the .js files are some kind of web stuff.
I must admit, that I have no clue, why unity changed the behaviour from 4.x to 5, as the folder was indeed skipped from compilation in unity prior to version 5. See also "specific folders" section below.
Possible solutions
1. Putting the potential script files in a specific folder
There are some specific folders, where unity does not try to compile your files e.g. WebPlayerTemplates.
see http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
2. Renaming the potential script files
As the unity compilation will only be performed for certain files (e.g. .cs or .js) you can avoid compilation by renaming them to e.g. .js_
For sure, both solutions will break your plugin in the first place, if you won't adapt it accordingly.
But what you can do is, to use a pre build hook to revert your changes (renaming or moving the files back) and make the plugin work on the device.
And just after the build again, to avoid the compilation (errors).
How to achieve this
Just create a custom build script (must be stored in an Editor folder, e.g. Assets/Editor). You'll find a new menu in unity named Build with an entry CustomBuild, where you can (and must) start your build.
Minimum version:
using UnityEditor;
using UnityEngine;
public class BuildProcessor {
[MenuItem ("Build/Custom Build", false, 0)]
static void CustomBuild() {
PreProcess();
BuildPipeline.BuildPlayer(new string[] { "your-main-scene.unity" }, "build-output-dir", BuildTarget.Android, BuildOptions.None);
PostProcess();
}
static void PreProcess() {
//Your pre-process here (e.g. rename all files from .js_ to .js)
}
static void PostProcess() {
//Your post-process here (e.g. rename all files back from .js to .js_)
}
}
More advanced scripts can be found on the web, or just feel free to add your creativity here ;-)
I took some inspiration here: http://jon-martin.com/?p=309
For how to rename a bunch of files you may want to check out this post: Renaming files in folder c#
I hope this will somehow satisfy your needs, let me know if something is not clear to you.

Cocos2d-js: projects need to be that huge?

I'm trying out cocos2d-js (version 3.0) and even the simplest 'Hello World' project is over 1 gigabyte in size when it is created.
Is this normal? (I have a habit of creating dozens of demo-projects when trying out a new platform, but it looks like I need to get myself a bigger SSD, just for this!)
Also, the size of the apk, when compiled for Android, is about 9 MB. Any ways to reduce this size?
Sadly, yes. I've mentioned this in the community a couple of times to no avail. I believe this files should be referenced/cached in a common location for all projects, but the dev team seems to have other priorities at present.
If you wish to keep your projects you'll be better off heading to their frameworks directory and deleting all folders except cocos2d-html5 (this one should be 5MB only) in there. -
An alternative would be to also delete the cocos2d-html5 folder, place it in a common dir (or use the copy in your install folder) and reference the path properly in your projetc's config file. Keep in mind this option may break code suggesstion/autocomplete in some editors, and throw errors in your webserver when you try to run the project.-
This way, you'll be able to run any of those projects in the browser, and then only add the files neccessary for native compilation in projects you wish to test in the emulator or your device (or compile for publishing). This will sadly take a lot of time to copy and re-generate the files, of course.
As for reducing the size of the .apks... I don't know a way. I know efforts are being made to optimize the binder, and there may be a way to explicitly avoid packaging unused stuff, but I don't know about it.
You can reduce the app size in Cocos2d-js v3.2 released in January. It allows you to exclude the unused modules. Refer to the upgrade guide for more details on how to do this. The minimum apk size for Android is 4.4mb .

Deploying Maqetta web workspace on MonoDroid

I'm researching the possibility of using Xamarin (MonoDroid) and Maqetta for building a cross-platform app. Before I ask my question I must admint to being a novice Android developer.
I'm curious to how I'm supposed to deploy the workspace I get from Maqetta on my android device. The Zip-file I download contains a very simple web project with two views in a .html file similar to this tutorial: http://www.youtube.com/watch?v=J0LneuYl280&feature=plcp
The thing is that the .zip file contains over 6500 files, but OK... It's no more than 8 MB total. I drag the entire folder structure into the Assets folder on Visual Studio. When building I get the following error:
Error 1 Invalid resource directory name: "assets". C:\Users\the\Desktop\Jobb\ImageCaptureApplication\ImageCaptureApplication\aapt.exe ImageCaptureApplication
I don't get anything else from this error.
Whats the story about this Assets folder? If I dig deep into the web workspace I got from Maqetta and remove the 'dojox' folder under "/lib/dojo/" now at least I'm able to compile and build the code, but my web page doesn't look like anything.
Is the file number too high for the Assets folder? Could it be too many levels in the directory tree from Maqetta? I understand there is a limit of 1 MB per file, but a search tells me that it doesn't look like I'm violating this rule.
It would definatly be too cumbersome to manually scan through each release of the Maqetta web project trying to filter out unnecessary dependencies..
Maqetta download size is a problem. You can select/deselect individual libraries, but the Dojo library, when included, is included in its entirety. You can edit the Dojo directory manually, as you have, or use the Dojo build script or the Dojo Web Builder (build.dojotoolkit.org) to create a smaller subset of the toolkit based on your usage. Maqetta integration with the Dojo Web Builder is a work in progress.
Was this "assets" folder part of Dojo? Did you identify where it was? The only problem I was aware of with the Android app builder is that it had a problem with underscores in filenames, but I believe that has been fixed.

Preloaded Android application with .so library file cannot be upgraded

I work for an operator, and we preload applications on Android phones.
However, some preloaded applications, once upgraded from Market, crash.
The problem is this:
- the application contains a .so library file
- in order to preload the complete application on a phone, the .so library file has to be placed separately into the lib directory (/system/lib/libXXXXjni.so)
- when the preloaded application is upgraded from Market and run, instead of the .so library file in the new APK being found, the older preloaded .so file is found first - causing a crash, because the two .so fiels have differing contents
Does anyone have a suggested work-around, or knowledge of the library-searching algorthim which may help me solve this?
One possible solution might be to simply rename the library file, but is that enough?
Thanks in advance...
When you preload, try putting the applications library in:
/data/data/com.package.foobar/lib/libXXXXjni.so
Renaming the library would work. Possibly using the app's version number as the name of the .so file. The build becomes more complicated though.

Categories

Resources