Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12591] Titanium Studio does not copy contents of /platform/android/assets folder to /build/android/bin/assets folder

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2013-04-30T21:39:21.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 09 Core, 2013 Sprint 09
ComponentsCore
Labelsandroid, assets, core, studio, titanium
ReporterPerminder Singh Bhatia
AssigneeAllen Yeung
Created2012-09-27T07:07:52.000+0000
Updated2017-03-28T21:11:34.000+0000

Description

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.

Attachments

FileDateSize
androidmodulestructure.png2012-10-02T21:09:12.000+000036499
AndroidSampleTC-130.zip2012-10-04T07:40:08.000+0000307336
builder.py2012-09-27T07:07:52.000+000084518

Comments

  1. Perminder Singh Bhatia 2012-10-01

    Please update
  2. Daniel Sefton 2012-10-02

    Screenshot showing the correct folder structure.
  3. Daniel Sefton 2012-10-02

    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.
  4. Perminder Singh Bhatia 2012-10-03

    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.
  5. Perminder Singh Bhatia 2012-10-04

    Adding Sample Android Project explained in scenario as given in comment
  6. Daniel Sefton 2012-11-20

    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:
       try {
           Log.d(LCAT, "Property from assets is....."+ this.getActivity().getAssets().open("properties/default.properties"));
           InputStream stream = this.getActivity().getAssets().open("properties/default.properties");
             
           Properties prop = new Properties();
           prop.load(stream);
             
           String propValue = prop.getProperty("prop.value1");
           Toast.makeText(this.getActivity().getBaseContext(), propValue, Toast.LENGTH_LONG).show();
       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
       
    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.
  7. Perminder Singh Bhatia 2012-11-29

    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.
  8. Daryl Stites 2013-03-28

    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.
  9. Allen Yeung 2013-04-30

    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.
  10. Perminder Singh Bhatia 2013-05-01

    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.
  11. Allen Yeung 2013-05-01

    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.
  12. Lee Morris 2017-03-28

    Closing ticket as invalid.

JSON Source