GitHub Issue | n/a |
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-04-30T21:39:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 09 Core, 2013 Sprint 09 |
Components | Core |
Labels | android, assets, core, studio, titanium |
Reporter | Perminder Singh Bhatia |
Assignee | Allen Yeung |
Created | 2012-09-27T07:07:52.000+0000 |
Updated | 2017-03-28T21:11:34.000+0000 |
when any file is added to /platform/android/assets folder that file is not accessed by an SDK consumed by titanium module as it accesses file from the assets folder.
As analyzed any file which is present in /platform/android/assets folder is not copied by builder.py to /build/android/bin/assets folder. As a result this file is not picked by SDK consumed by titanium module.
I tried modifying builder.py to fix the issue and it worked in all cases but not when /build/android/bin/assets is not created for the first time.
I am attaching modified builder.py file for your reference and you can check the code added by searching comments having text "Perminder"
I am using Titanium SDK 2.1.2GA
Please provide a quick resolution to this issue as this can halt a delivery.
Please update
Screenshot showing the correct folder structure.
Hi Perminder, If you are making an android module, then I believe you are using the wrong folder structure. I have attached a screenshot showing the correct structure. There's a wiki page here with more information: https://wiki.appcelerator.org/display/guides/Using+density-specific+resources+on+Android If that still doesn't fix your issue, could you please provide some more information about what you are trying to achieve, and why you are doing it that way etc. If it does, please let me know so that I can resolve the issue. Thanks.
Hi Daniel, I am perfectly in sync with the link shared but i am not talking about images or resource files (res folder) and rather concerned about the configuration/non-resource files we bundle in an android project (assets folder). To take a scenario, consider a normal Android project wherein we put a file named default.properties in Project/assets/properties folder which are then picked by the native code using this.getAssets().open("properties/default.properties") but when i have to build such a scenario in Titanium App i have only choice of putting this file in Project/platform/android/assets/properties folder but this does not seems to work and this is for the reason which i described in the description section. Now, please help me in understand as if am i doing anything not supported by Titanium or doing in a wrong way. Thanks.
Adding Sample Android Project explained in scenario as given in comment
Hi Perminder, Sorry for the delay. So we tested this by creating a simple module project for Android, and inside exampleproxy.java we used this code inside the createView() method:
We then copied your properties file into assets folder. Unfortunately we could not reproduce the issue, the contents are copied as expected on 2.1.2 GA and 2.1.4 GA.
Daniel, Using files in the assets folder in a Titanium Module Project will work, but if you want to use assets folder in a Titanium Application then it will not work. The issue i want to report here is with respect to Titanium Application and not with Titanium Module. The problem i am facing is that if i want to give user an option to provide values in a properties file and add that properties file in assets folder under /platform/android/assets in a titanium application and want to read that properties file in my Titanium Module during runtime, then that is impossible as the file present under /platform/android/assets folder does not gets copied to /build/android/bin/assets folder. Since /build/android/bin/assets folder is created by builder.py script of Titanium SDK to create an Android project from Titanium Project to create an android application .apk file, this script does not happen to copy contents of /platform/android/assets folder to /build/android/bin/assets folder as a result final .apk file generated does not contain the .properties file and module is not able to access it. Please re-open this issue as the problem is not understood properly. you can ping me at permindersb on skype if you want more clarity. please treat this issue dead critical now.
Is there any update on if there is a workaround for this issue? I am encountering the same problem in 3.0.2 GA, with the Urban Airship module that references its configuration file in the (expected) /platform/android/assets instead of /platform/android/assets/Resources, which is the only folder I can get to copy during the build process.
Marking this bug as invalid. Placing something inside /platform/android/assets folder should copy your files to /build/android/assets and NOT /build/android/bin/assets. I have verified that this works correctly in 3.1.0.GA. If you would like to place something inside /build/android/bin/assets, you would need to place your files under /platform/android/bin/assets. I have verified that this works as well in 3.1.0.GA.
Allen, Why is this invalid, rather it should be fixed for the current version and the justification for the same is that it was already proved to be a bug in previous versions whereas it is not occurring in current version. So, there is only one thing which could have happened to this bug is that it got fixed and no bug repairs itself whereas the people fixes them.
As I mentioned in my comment above, the reported behavior specified in the bug is invalid. The /platform/android/assets should never copy to /build/android/bin/assets and that was never expected behavior. This is why the bug is invalid.
Closing ticket as invalid.