General

Player ranks
It took a while to find a hint on how you get your player levels and apparently if you click on the top left corner, where it shows your pvp medals and scroll all the way to the top and exit your rank you get this : So you gain levels, according to the amount of medals that you get. Now it's the first game that I have seen that your levels are tied to your pvp rank, especially since in pvp fights you get no control, heals, air strikes and basically all troops attack randomly pretty much but all your base upgrades are tied to this rank which means you  must  pvp. I don't know if you drop a rank if you lose just after you gain one,but I'll test it on the next one.
 * Private: 0-6 medals
 * Lance corporal: 7-49 medals
 * Corporal: 50-99 medals
 * Sergeant: 100-199
 * Staff sergeant: 200-399
 * Warrant officer: 400-699
 * Lieutenant: 700-1099
 * Captain: 1100-1599
 * Major: 1600-2199
 * Colonel: 2200-2899
 * Brigadier: 2900+

Troops level and XP
When fighting against opponents, your troops will earn XP based on their activity. If they eliminate an enemy, the XP received after the match will be greater than a troop that has not eliminated any enemy.

This XP is used to increase the limit of training that your troop can achieve. When reached a certain level of XP, the troop can be upgraded to the next "troop rank" (number of stars above the troop). This will, again, enlarge the maximun lelvel of the troop and the training that could be done.