I've been looking for much on google about the problem, but I have not resolved. The map is displayed, but I located at the point where I want and still giving me the same failure:
06-09 12:10:57.231: I/MapActivity(1532): Handling network change
notification:CONNECTED 06-09 12:10:57.231:
W/IdleConnectionHandler(1532): Removing a connection that never
existed! 06-09 12:11:04.829: W/KeyCharacterMap(1532): Can't open
keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532): Error
loading keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532):
Using default keymap 06-09 12:11:57.080: I/MapActivity(1785): Handling
network change notification:CONNECTED 06-09 12:11:57.080:
E/MapActivity(1785): Couldn't get connection factory client
And I do not understand because I've followed all the steps to generate the api key, my Activity extends from MapActivity, and and I added my android manifiest permits and libraries.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXX.XXX"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.Gmaps"/>
</application>
</manifest>
Gmaps Activity
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class Gmaps extends MapActivity{
private MapView mapa = null;
private MapController control = null;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gmaps);
mapa = (MapView)findViewById(R.id.mapa);
mapa.setBuiltInZoomControls(true);
Double latitud = 40.4166909;
Double longitud = -3.7003454;
GeoPoint loc = new GeoPoint(latitud.intValue(), longitud.intValue());
control = mapa.getController();
control.setCenter(loc);
control.setZoom(7);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
gmaps.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="#+id/mapa"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0htJ1gM0WymyYYokI3eUunfuJ2-XXXXXXXXX"
android:clickable="true"/>
</RelativeLayout>
Sorry for my english !! jeje :)
Sign your application with a keystore and generate an apk for your application using this keystore.Then install this on your device. This would solve your problem.The map api key you are using must be generated with this keystore only.
Related
i know this sound stupid by asking the question that many people had already asked before, but i am getting frustated by now because every answer that i looked after (more time than i care to mention), regarding those error could not make my code right.
i watched the code making in youtube and downloaded here.
anyway here is my sample code
package com.example.googlemapsdemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity {
private final LatLng LOCATION_PALEMBANG = new LatLng(-2.938201, 104.6892742);
private final LatLng LOCATION_JOHOR = new LatLng(1.5618762, 103.6365218);
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); <-----this line (R cannot be resolved to a variable)
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); <-----this line (R cannot be resolved to a variable)
map.addMarker(new MarkerOptions().position(LOCATION_PALEMBANG).title("Find me here!"));
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu); <--- this line (same error)
return true;
}
public void onClick_City(View v) {
// CameraUpdate update = CameraUpdateFactory.newLatLng(LOCATION_PALEMBANG);
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_PALEMBANG, 9);
map.animateCamera(update);
}
public void onClick_Burnaby(View v) {
map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_PALEMBANG, 14);
map.animateCamera(update);
}
public void onClick_Surrey(View v) {
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_JOHOR, 16);
map.animateCamera(update);
}
}
and this is my android manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapsdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<permission
android:name="com.example.googlemapsdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.googlemapsdemo.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<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" >
<uses-library
android:name="com.example.googlemapsdemo" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCravI-Yxyh1702ZX9s4O5cL_lWmoGz9qo"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.example.googlemapsdemo.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>
and activity main code :
<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" >
<Button
android:id="#+id/btnJohor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:onClick="onClick_Johor"
android:text="Johor" />
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_below="#+id/btnSurrey"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<Button
android:id="#+id/btnPalembang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="onClick_Palembang"
android:text="Palembang" />
<Button
android:id="#+id/btnCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:onClick="onClick_City"
android:text="City" />
also i'm having a problem with my values-v14, it is said that :" Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'."
please can anybody help me ?
This error is usually caused by either of these possibilities:
The most probable: You have a syntax error in any of your layout files (i.e., the files located under the res\layout folder of your project). The bad thing of this is that Eclipse won't warn you and tell you where's the error, so you'll have to go one by one looking for the syntax (probably an unmatched tag, an unmatched attribute, etc.) and fix the issue.
The other possibility is a syntax error within your AndroidManifest.xml file. Same goes here, check it for syntax errors.
One of these two will fix your issue.
Following this tutorial I started working on integrating AdMob into Unity, but as this uses an older version I had to make some changes to update it to the Google Play Services version, but I think I may have messed up.
I imported all the required libraries into both Unity 3D's Plugins/Android and Eclipse's Java Build Path and Order and Export.
Every time I call the script in Unity the game crashes and LogCat says it had an error with a tag "AndroidRuntime" "at admob.admob$1.run(admob.java:52) which is this line
adView.loadAd(adRequest);
Here's my AdMobController.js from Unity:
#pragma strict
public class AdMobController extends MonoBehaviour {
private static var s_Controller : AdMobController;
private static var jo:AndroidJavaObject;
function Awake()
{
s_Controller = this;
#if UNITY_ANDROID
jo = new AndroidJavaObject("admob.admob");
#endif
}
}
File admob.java
package admob;
import com.google.android.gms.ads.*;
import com.unity3d.player.UnityPlayer;
import android.app.Activity;
import android.util.Log;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
public class admob{
// private String pubID = "ADMOB_ID_HERE"; //Your public AdMob ID. Make sure this is correct, or you won't get any credit for the Ad.
private Activity activity; //Store the android main activity
private AdView adView; //The AdView we will display to the user
private LinearLayout layout; //The layout the AdView will sit on
//Constructor
public admob() {
activity = UnityPlayer.currentActivity;
activity.runOnUiThread(new Runnable() {
public void run() {
/*
layout = new LinearLayout(activity);
activity.addContentView(layout, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
adView = new AdView(activity);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(pubID);
AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
adView.loadAd(adRequestBuilder.build());
*/
layout = new LinearLayout(activity);
// Create the adView.
adView = new AdView(activity);
adView.setAdUnitId("MY_AD_ID"); //Yes, I put the correct ID here. I only deleted it before posting here.
adView.setAdSize(AdSize.BANNER);
// Add the adView to it.
layout.addView(adView);
activity.addContentView(layout, new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // Emulator
.addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4") // Test phone. Not my actual phone because I could
// not call AdRequest to get the ID for it.
.build();
// Load the adView with the ad request.
Log.d("unity321", "unity321");
adView.loadAd(adRequest);
layout.addView(adView.getRootView(), new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// Code in here will run on the UI thread of this application
}
});
}
}
AdMob manifest from Eclipse:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.admob.admob"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
And finally the manifest in the plugins folder in Unity used to override the Unity built manifest (NOTE: android:value="google_play_services_version" is changed because with the #integer/ both Unity and Eclipse said no value was found and would not export)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.TESTCOMPANY.TESTAPP"
android:theme="#android:style/Theme.NoTitleBar"
android:versionName="1.0"
android:versionCode="1"
android:installLocation="auto">
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
<application android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="true">
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:label="#string/app_name"
android:screenOrientation="sensorLandscape"
android:launchMode="singleTask"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity"
android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"
android:value="true" />
<meta-data android:name="com.google.android.gms.version"
android:value="google_play_services_version"/>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="19" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Yep, this is what I did.
Make another folder in unity; where your plugins are.
Mine is Assets/plugins/android/
You need Assets/plugins/android/res/values
In the values folder save this in an xml file named values.xml
<?xml version="1.0" encoding="UTF-8"?>
-<resources>
<integer name="google_play_services_version">4132500</integer>
</resources>
Copy the folder google_play_services from <Android sdk>/extras/google/ to the Assets/Plugins/Android folder in Unity and build the project again.
I have a tablet Genesis GT-7240, Android 4.1.1, Kernel 3.0.36+.
My manifest.xml:
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" />
It is a simple app, using Google Maps and so it must be compiled with API GOOGLE.
As I testing in a real device, I checked 'Unknown sources', copied the compiled apk into 'download' folder of the tablet, and I tried install it as I always usually do.
However, has a message
X App not instaled.
Another tablet, which has Android 3.2, the same app works perfectly.
Is there a issue with Android 4.1 and Api Google compilation?
[Editing]
My manifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MY_PACKAGE_HERE"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission android:name="MY_PACKAGE_HERE.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="MY_PACKAGE_HERE.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="MY_PACKAGE_HERE.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>
<uses-library android:required="true" android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_APY_KEY_HERE"/>
</application>
</manifest>
My activity_main layout:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
My MainActivity.java:
package MY_PACKAGE_HERE;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.*;
import android.view.Menu;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
private GoogleMap gm;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if (status == ConnectionResult.SUCCESS) {
SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
gm = supportMapFragment.getMap();
}
else {
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
dialog.show();
}
}//onCreate
//*****************************
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
I have did all steps which is give at google but lastly it give's this
errorCaused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapsdemo"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.googlemapsdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.googlemapsdemo.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<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.googlemapsdemo.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBLHwjdXsQK0sszxfrkoncHlqU3d2mDJok" />
</application>
</manifest>
MainActivity.java:
package com.example.googlemapsdemo;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;
public class MainActivity extends Activity
{
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try
{
// Loading map
initilizeMap();
} catch (Exception e)
{
e.printStackTrace();
}
}
/**
* function to load map. If map is not created it will create it for you
* */
private void initilizeMap()
{
if (googleMap == null)
{
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null)
{
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
#Override
protected void onResume()
{
super.onResume();
initilizeMap();
}
}
manifest file
For eclipse add this :
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
If you are using Android Studio(latest version) with gradle0.7+ then add this line:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Your Key" />
Add the Google Play services version to your app's manifest
Edit your application's AndroidManifest.xml file, and add the
following declaration within the element. This embeds the version of
Google Play services that the app was compiled with.
You just need to add <meta-data> under <application> tag into your AndroidManifest.xml
....<application>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
I have included all the necessary fields correctly.
But still, I am not able to launch the Google map on my emulator.
Checked the internet permissions also.
Getting error like:
E/AndroidRuntime(2064): java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{util.kalyan/util.kalyan.HelloGoogleMapsActivity}:
java.lang.ClassNotFoundException: util.kalyan.HelloGoogleMapsActivity
Please find below my code.
HelloGoogleMapsActivity.java
package util.kalyan;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import util.kalyan.R;
public class HelloGoogleMapsActivity extends MapActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed()
{
return false;
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="util.kalyan"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<uses-library android:name="com.google.android.maps"></uses-library>
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name" >
<activity android:name=".HelloGoogleMapsActivity" android:label="#string/app_name" android:theme="#android:style/Theme.NoTitleBar">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses- permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Any one please help me in this at the earliest.
Thanks in advance.
Change the android:name in activity definition
from
<activity android:name=".HelloGoogleMapsActivity" ../>
to
<activity android:name="util.kalyan.HelloGoogleMapsActivity" ../>
You emulator target should be one that includes Google APIs (Google Inc.).
Right click on your HelloGoogleMapsActivity class > BuildPath > Exclude Then Right click on your HelloGoogleMapsActivity class > BuildPath > Include your class again