Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm newer in development google maps Apps in android eclipse I have problem when run my APP the error is "unfortunately APPname has stopped" this is my code

MainActivity.java

Java
public class MainActivity extends Activity {

	
	//static final LatLng TutorialsPoint = new LatLng(21 , 57);
    private GoogleMap googleMap;

    @SuppressLint("NewApi") @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        
        try {
            if (googleMap == null) {
               googleMap = ((MapFragment) getFragmentManager().
               findFragmentById(R.id.map)).getMap();
            }
            googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            Marker TP = googleMap.addMarker(new MarkerOptions().
            position(new LatLng(0, 0)).title("SomePoint"));
         }
         catch (Exception e) {
            e.printStackTrace();
         
      }
    }


this is manifestfile

XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ljgdhjro"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    
    
    
    <meta-data
   android:name="com.google.android.maps.v2.API_KEY"
   android:value="AIzaSyBcc-Lg3Lz0qDhpdKmSHZTAy59g_p0kzgQ"/>
    
    
    
      <permission
        android:name="com.example.ljgdhjro.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"></permission>
    <uses-permission
        android:name="com.example.ljgdhjro.permission.MAPS_RECEIVE"/>
    <uses-permission
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission
        android:name="android.permission.INTERNET"/>
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission
        android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission
        android:name="android.permission.ACCESS_FINE_LOCATION"/>
    
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
    
    
    
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.ljgdhjro.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


What I have tried:

this Activity XML

HTML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <fragment
      android:id="@+id/map"
      android:name="com.google.android.gms.maps.MapFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

</RelativeLayout>
Posted
Comments
Mohibur Rashid 6-Apr-16 17:26pm    
What was the error message in your development console?
_Tuba 9-Apr-16 13:15pm    
nothing just when run it Ihave this Unfortunately appname has stopped
Mohibur Rashid 12-Apr-16 1:15am    
Nothing does not seems like a valid answer. Try to read your Error log briefly. and Make sure you didn't screw your mainfest.xml
Sergey Alexandrovich Kryukov 6-Apr-16 18:05pm    
Do you really call an application "AppName"? And what is the name of this name? :-)
—SA
_Tuba 9-Apr-16 13:13pm    
Yes I called it, name is application name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900