Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1568] Alloy CFG is not always generated correctly, uses an old config.json

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2015-09-29T01:53:24.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
LabelsAlloy.CFG, config.json
ReporterPatrick van Vuuren
AssigneeShak Hossain
Created2015-02-11T22:03:15.000+0000
Updated2016-03-08T07:38:02.000+0000

Description

Hello, When using the config.json I expect that when I change the file, it will be changed next time I run the application on an emulator or device. A few times today this was not the case. When doing a project -> clean worked for some reason. A sample config.json I used:
{
  "global": {
    "TMDB": {
      "API_KEY": "SOME_KEY"
    },
    "COLORS": {
      "ACTION_BAR_COLOR": "#0e83cd",
      "MAIN_COLOR": "#0e83cd"
    },
    "URLS": {
      "IMAGES": {
        "POSTER": "http://image.tmdb.org/t/p/w500"
      },
      "SEARCH": {
        "MOVIE": "http://api.themoviedb.org/3/search/movie"
      },
      "MOVIES": {
        "ID": "http://api.themoviedb.org/3/movie/{id}",
        "NOW_PLAYING": "http://api.themoviedb.org/3/movie/now_playing",
        "UPCOMING": "http://api.themoviedb.org/3/movie/upcoming",
        "POPULAR": "http://api.themoviedb.org/3/movie/popular",
        "TOP_RATED": "http://api.themoviedb.org/3/movie/top_rated",
        "TRAILERS": "http://api.themoviedb.org/3/movie/{id}/videos",
        "REVIEWS": "http://api.themoviedb.org/3/movie/{id}/reviews",
        "CREDITS":"http://api.themoviedb.org/3/movie/{id}/credits",
        "DERP":"http://api.themoviedb.org/3/movie/{id}/derp"
      }
    },
    "TAB_PAGES": [
      "nowplaying",
      "upcoming",
      "popular",
      "toprated"
    ]
  },
  "env:development": {},
  "env:test": {},
  "env:production": {},
  "os:android": {},
  "os:blackberry": {},
  "os:ios": {},
  "os:mobileweb": {},
  "dependencies": {
    "nl.fokkezb.pullToRefresh": "2.1.0"
  }
}
I cannot reproduce the problem everyone time, and it only seems to happen on Android (Tested it with Genymotion emulators). Regards, Patrick

Comments

  1. Shuo Liang 2015-02-12

    Hi, This is normal behave. Alloy uses the config.json file, located in the project's app directory, to specify global values, conditional environment and platform values, and widget dependencies. Some of those config properties will be saved in build folder after running, and will not be re-written in order to accelerate next build. If you do change something in config.json file or tiapp.xml file, the best practice is clean the probject before next running. Regards, Shuo
  2. Tim Poulsen 2015-02-13

    [~Serfenia] I think you might be running into ALOY-1206 which is fixed for Alloy 1.7. If not, changing the config.json file should trigger its re-processing the next time you build the app. If that's not happening, then this could indicate a bug. Please try to narrow down a reproducable set of conditions so that we can be sure we're able to see the issue and know when it's been resolved.
  3. Rakhi Mitro 2015-09-06

    Hello, I have tested this issue in updated environment. This is not a bug for latest Appcelerator version. Not sure if this is still an issue for you. It doesn't appear to be based on our latest tests. Please let me know how I can help further. *Test Environments:* CLI Version :4.0.1 Titanium SDK Version:4.1.0.GA Android: Google Galaxy Nexus:4.1.1 - API 16 - 720x1280 Appc Studio: Appcelerator Studio, build: 4.1.1.201507141126 Alloy: 1.7.6 iOS Simulator: iPhone 4s *Test Case:* * Create a alloy project. * Paste sample code into *app>config.json*. * Run the project *Test code:* *config.json*
       
       {
         "global": {
           "TMDB": {
             "API_KEY": "SOME_KEY"
           },
           "COLORS": {
             "ACTION_BAR_COLOR": "#0e83cd",
             "MAIN_COLOR": "#0e83cd"
           },
           "URLS": {
             "IMAGES": {
               "POSTER": "http://image.tmdb.org/t/p/w500"
             },
             "SEARCH": {
               "MOVIE": "http://api.themoviedb.org/3/search/movie"
             },
             "MOVIES": {
               "ID": "http://api.themoviedb.org/3/movie/{id}",
               "NOW_PLAYING": "http://api.themoviedb.org/3/movie/now_playing",
               "UPCOMING": "http://api.themoviedb.org/3/movie/upcoming",
               "POPULAR": "http://api.themoviedb.org/3/movie/popular",
               "TOP_RATED": "http://api.themoviedb.org/3/movie/top_rated",
               "TRAILERS": "http://api.themoviedb.org/3/movie/{id}/videos",
               "REVIEWS": "http://api.themoviedb.org/3/movie/{id}/reviews",
               "CREDITS":"http://api.themoviedb.org/3/movie/{id}/credits",
               "DERP":"http://api.themoviedb.org/3/movie/{id}/derp"
             }
           },
           "TAB_PAGES": [
             "nowplaying",
             "upcoming",
             "popular",
             "toprated"
           ]
         },
         "env:development": {},
         "env:test": {},
         "env:production": {},
         "os:android": {},
         "os:blackberry": {},
         "os:ios": {},
         "os:mobileweb": {},
         "dependencies": {}
       }
       
    *Test Result:* Alloy CFG is always generated correctly. Thanks

JSON Source