The president said it was critical to develop diverse energy resources.
He also attacked government subsidies for oil companies.
"Four billion dollars," Obama said. "These are the same oil companies that have been making record profits off the money you spend at the pump. And now they deserve another $4 billion from us?
"It's outrageous. It's inexcusable. And every politician who's been fighting to keep these subsidies in place should explain to the American people why the oil industry needs more of their money. Especially at a time like this."
At the "energy event" at the University of Miami, Obama said: "Right now, we're experiencing yet another painful reminder of why developing new energy is so critical to our future. Just like last year, gas prices are climbing across the country -- except this time, even earlier. And that hurts everyone."
Obama said "some politicians always see this as a political opportunity. You're shocked, I know. Last week, the lead of one news story said, 'Gasoline prices are on the rise, and Republicans are licking their chops.' Only in politics do people greet bad news so enthusiastically. You pay more, and they're licking their chops? And you can bet that since it's an election year, they're already dusting off their three-point plans for $2 gas. I'll save you the suspense: Step one is drill, step two is drill, and step three is keep drilling. We heard the same thing in 2007, when I was running for president. We hear the same thing every year. We've heard the same thing for 30 years.
"Well the American people aren't stupid. You know that's not a plan -- especially since we're already drilling. It's a bumper sticker. It's not a strategy to solve our energy challenge. It's a strategy to get politicians through an election."
The president said: "There are no quick fixes to this problem, and you know we can't just drill our way to lower gas prices. If we're going to take control of our energy future, if we're going to avoid these gas price spikes down the line, then we need a sustained, all-of-the-above strategy that develops every available source of American energy -- oil, gas, wind, solar, nuclear, biofuels, and more. We need to keep developing the technology that allows us to use less oil in our cars and trucks, in our buildings and plants. That's the strategy we're pursuing, and that's the only real solution to this challenge."
Obama said the United States is producing more oil than at any time in eight years.
But the president said in the long-term, "the biggest reason oil prices will rise is growing demand in countries like China, India and Brazil. ...
"So what does this mean for America? It means that anyone who tells you we can drill our way out of this problem doesn't know what they're talking about -- or isn't telling you the truth."
Republican GOP presidential hopefuls and GOP lawmakers blame Obama for the rise in gasoline prices. They also cast him as unfriendly to domestic oil production, particularly after his administration's decision to postpone the construction of the Keystone pipeline system.
Keystone is a pipeline system to transport synthetic crude oil and diluted asphalt to U.S. destinations from Alberta, Canada, north of Montana.
"President Obama has thwarted more American energy production at every turn, from his refusal to back bipartisan, House-passed energy bills to his rejection of the Keystone XL pipeline -- and now Americans are paying the price every time they fill up," House Speaker John Boehner, R-Ohio, said in a statement Tuesday.