As for me, more natural sounds "Я изучал русский язык в армии 9 месяцев". I think, you shouldn't say "в течениЕ" because this makes the sentence more difficult and sounds more official.
Are you really studied Russian in the army? Maybe you had same speaking practice?
One rule how to write "в течениЕ" or "в течениИ". It depends on the context.
When we speak about time and we can ask "How long?" we write "в течениЕ" for example: "He worked for three days/ Он работал в течениЕ трех дней".
When we speak about water flow and we can ask "Where?" we write "в течениИ" for example: "He saw a swimmer along the river/ Он увидел пловца в течениИ реки."