Both "J'habite à [city]" and "J'habite [city]" are acceptable, although nowadays I seem to hear more of the former than the latter.
J’habite Barcelone is marked wrong, tho’…
Hawkins French Grammar & Usage 3rd ed says: 8.3.5 : "habiter is directly transitive (no preposition rquired)" and adds that it "also appears in constructions like habiter à la campagne, habiter en ville, habiter en France. Here à la campagne, en ville and en France are not objects but adverbials; they can co-occur with direct objects: habiter une petite maison à la campagne, habiter un bon quartier en ville, etc." At 12.9, in the context of Infinitives in subordinate clauses, it includes "Habiter Paris est très agréable". Schaum at p292 5th ed, says "habiter, demeurer and vivre all mean to live. Habiter and demeurer mean to live, to dwell and are used with names of places. Il demeure à Paris. Elle habite à Paris. Habiter is sometimes used without a preposition. Il habite l'Angleterre. Il habite Paris." Collins Le Robert dictionary says "habiter" means "to live in" - the "in" here is not as significant as it seems, however, because it also has numerous examples of uses of the word with and without à .
It seems that both are correct.
Sign in to submit your answer
Don't have an account yet? Join today
Test your French to the CEFR standard