add custom .properties file in unity android package - android

I have a .properties file that is required by some android java unity plugin that I am writing. I need to add this file to the unity app's package somehow, so once the unity IDE builds the .apk, the file is located in the root of the apk's assets folder.
Where and how do I place this file in the Unity IDE? I tried putting it under Assets, but I inspected the resulting .apk file and the file did not make it there..
any ideas?
tnx

You have two options for including files accessible at runtime:
Managed assets in Ressources folders accessible via Resources.Load
Un-managed assets in the StreamingAssets folder accessible via the File or WWW APIs
Your .properties file should probably reside in the StreamingAssets folder, if you don't need Unity3D to process it. Unity3D will optimize assets in the Resources folders. For example an image will have to set as GUI or Texture in the IDE. Assets in the StreamingAssets folder are raw and not processed by the Unity3D IDE. So a png is a still a regular png at runtime. StreamingAssets is where we store mp4 mobile videos we don't want Unity3D to re-encode.

Related

Why can't I see `assets` folder in my Android package installation folder

I'm browsing with DDMS my application's installation folder /data/data/com.my.app and I can't find where the assets folder is. I'm using it inside my application using URI file:///android_assets/...
I can't find where the assets folder is
That is because there is no assets folder on the device. The assets, like your resources, are packaged into the APK file. Assets are not unpacked as part of APK installation. file:///android_asset/, for those things that understand it, knows to look inside of the assets in your APK.

how to make copy asset folder in apk directory?

I am making hybrid application.I have one file in this directory assest->www->ATMS.html or other js files.So I load in web view like this.
web.loadUrl("file:///android_asset/www/a.html");
I want to copy all file files and folders which is inside the asset folder.Instead of loading from assest folder .I need to load from copy folder.As some some told me that there is file system of APK file.Mean we can copy all files in apk file system .and load html from that APK file system .
There is few link give information to copy of assest folder
How to copy files from 'assets' folder to sdcard?
But I don't get knowledge how to copy in APK file system .Mean when Aplication uninstall it remove the copied folder .When application launch it make copy of assest folder in apk file system ..
thanks
Not sure I get your question fully right as explanation is bit messy, but while APK is ZIP file, you should really consider it read-only. So you can copy files out of it but you cannot add anything to your APK nor alter it at runtime.

Android: How to copy files to asset folder during build

I am developing a cross-platform project(iOS and Android).
I have a /resource folder that contain some .png files.
I know that only the files that in /asset folder are compiled into the .apk file.
Now I need copy the files from /resource to /asset folder manually.
It is too inconvenient.
Is is possible to copy files in /resource to /asset during build project automatically?
(p.s. I am using Eclipse for development.)

How to put extra files in Android APK with Eclipse?

I want to add a text file to my APK root. This file will not be used in the application but it will stay there for manual extraction of the APK.
I tried to put it into the root of the project in Eclipse but it didn't include that file in the APK. I don't want to put it into assets folder. Can't I put it to the root?
Use the assets folder.
According to Android developer
assets/
This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.
Files that are not put into any of the main directories of your android project will NOT be included in your apk. You MUST put the file in the assets so it can be accessed within the application as an external resource/file.

Android assets folder not added to apk

I'm pretty new to eclipse and Android and I'm trying to add some files to the assets folder, but certain files and directories are not being included in the .apk file.
I have set-up the following structure in the solution:
/assets
/textures
/test.png
/splash.png
/xml
/testData.xml
I don't know if there is a specific way to get eclipse to re-build/compile the project and add the new assets to the assets folder in the .apk, but the /xml subfolder (and its contents) are not in the apk. Subsequently I get FilenotFoundExceptions thrown when I deploy the app. The textures are all included.
How can I force a recompile and rebuild of the apk and is there anywhere to manually check which files are included in the project (like an assets manifest file)?
As far as I know there are no restrictions placed on hierarchy or file formats for within the assets folder. Also, when I dragged the files from the desktop to the solution explorer, I selected 'copy files to project'.
Thanks
It appears one cannot use upper-case letters in the naming of files within the assets folder. Contrary to my example above, I was actually using camel-backed file names within the folders. After changing the file names to lower-case, the apk was automatically re-built with the assets the next time I deployed

Categories

Resources