i'm trying to make an Android App
using Google Maps Api
, for that I followed the same step (exact) made by the famous (Ravi Tamada ) is his tutorial:
Link to the tutorial: http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/
but when I try to compile the project an run it on my Android device (Samsung Galaxy S3, Android Version: 4.1.2)
it crashes and gives me the following error msg in the LogCast!
Link to My LogCast: http://openensak.com/img/LogCast.png
i don't know what's wrong !!!
use
import android.support.v4.app.Fragment;
YourActivity extends FragmentActivity
instead of
import android.app.Fragment;
YourActivity extends Activity
and Please add the API KEY in your manifest file
<application>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="youApiKey"
/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"
/>
</application>
is in the element of AndroidManifest.xml
I think you can not include google-play-services.jar to your project. Because of that, fragment in your layout can not be inflated. Be sure about adding google-play-services.jar to your project. Or add your class
import android.support.v4.app.Fragment;
and instead of using
public class MainActivity extends Activity
use public class MainActivity extends FragmentActivity
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.