Predicting how species will respond to the rapid climatic changes predicted this century is an urgent task. Species Distribution Models (SDMs) use the current relationship between environmental variation and species' abundances to predict the effect of future environmental change on their distributions. However, two common assumptions of SDMs are likely to be violated in many cases: (1) That the relationship of environment with abundance or fitness is constant throughout a species' range and will remain so in future, and (2) That abiotic factors (e.g. temperature, humidity) determine species' distributions. We test these assumptions by relating field abundance of the rainforest fruit fly Drosophila birchii to ecological change across gradients that include its low and high altitudinal limits. We then test how such ecological variation affects the fitness of 35 D. birchii families transplanted in 591 cages to sites along two altitudinal gradients, to determine whether genetic variation in fitness responses could facilitate future adaptation to environmental change. Overall, field abundance was highest at cooler, high altitude sites, and declined towards warmer, low altitude sites. By contrast, cage fitness (productivity) increased towards warmer, lower altitude sites, suggesting that biotic interactions (absent from cages) drive ecological limits at warmer margins. In addition, the relationship between environmental variation and abundance varied significantly among gradients, indicating divergence in ecological niche across the species' range. However, there was no evidence for local adaptation within gradients, despite greater productivity of high altitude than low altitude populations when families were reared under laboratory conditions. Families also responded similarly to transplantation along gradients, providing no evidence for fitness trade-offs that would favour local adaptation. These findings highlight the importance of (1) measuring genetic variation of key traits under ecologically relevant conditions, and (2) considering the effect of biotic interactions when predicting species' responses to environmental change.