Bubbles can appear when painting on walls for several different reasons such as painting in too hot or humid weather or painting on walls that have moisture on them or moisture coming through the walls.
If the weather is too humid you should wait to pain the walls when the weather is not very humid out or use a dehumidifier to remove excess humidity in the place you're painting.
If you do get bubbles while painting the wall use a scraper and scrap away the bubbles before they dry completely and then sand the area down and repaint again.
After you sand the area down and before you paint it make sure the wall is clear of any dust or particles and is dry before painting.