Typically the AI attacks you because they perceive that you are weak. The easiest way to avoid being attacked is to build a strong military.
The following works pretty well on the lower levels:
Land Grab. You need to get as many planets as possible. Initially you should allocate 100% to military and crank out colony ships as fast as you can. Colonize as many yellow systems as you can (but only one planet in the system at first). After you have claimed as many yellow planets as possible, use the left over colony ships to colonize the 'extra' planets in a system or grab PQ level 14 planets.
Once the land grab is complete, switch your sliders to 100% research and research Comm Theory, Universal Translator, and Diplomacy.
At this point I usually adjust the sliders again and split my spending evenly between Social and Research. Build Soil Enhancement and Banking on every planet. When Earth builds a bank, I usually have them work on Diplomatic Translators. The game becomes much easier if you can get this Trade Good. Keep it for yourself. Build the Entertainment Network on the other planets.
Now research Weapons Theory, Phasers, Photons, and Corvettes. The goal is to get to Corvettes quickly to build a 'paper military'. If an AI demands something other than a planet before you get to Corvettes, it is probably best to give them what they want. If they ask for a planet, tell them no but then immediately give them a gift (Cash, a tech, or a ship) to keep them off your back.
Make sure to trade techs whenever possible. Try to trade for techs that will add projects to the build queue (Habitat Improvement, Manufacturing Center, Economic Exchange, News Network, Research Center, ..)
Once you have researched Corvettes, adjust the sliders so that 50% is going to Military and 25% ,25% to the others. Start cranking out Corvettes until you have the strongest military. The corvettes are actually pretty useless, but they allow you to build a very strong 'paper army' that will keep the AIs off your back until you can actually do some real damage.
At this point the options are endless, depends on what type of game you want to play. If you are looking for a real military, hustle right along to Frigates.
There are a million other things, hopefully this will be enough to get you past the initial hostilities.
Oh yeah, you should join the Aldarian Empire LOL
[Message Edited]