I am new to SW development with Android.
Trying to have a MapView object in my display. Code is straightforward below. But for some reason when i launch the application i do not see any map but rather the grey grid.
I have looked at many posts on the internet and i understand that it is either an INTERNET permission (which is included in my coe) or a wrong apiKey. I have gone through the apiKey several time.
Am not sure what can be wrong. Any help would be great. Thanks, Lebnen.
-----------------------------------------------
Manifest.xml
-----------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.testmap"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />
<activity android:name=".TestMapActivity"
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>
-----------------------------------------------
main.xml
-----------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
androidrientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
>
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:enabled="true"
android:apiKey="0SA_n7tIj-klgGxARuFJgEos8FBGtEshpgmfogA"
/>
</LinearLayout>
-----------------------------------------------
testMapActivity.java
-----------------------------------------------
package com.test.testmap;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.LinearLayout;
import com.google.android.maps.MapView;
import com.google.android.maps.MapController;
import com.google.android.maps.MapActivity;
import com.google.android.maps.GeoPoint;
public class TestMapActivity extends MapActivity {
private MapView mapView;
LinearLayout linearLayout;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mapView = (MapView) this.findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setSatellite(true);
}
@Override
public boolean isRouteDisplayed() { return false; }
}
Dont see your manifest. Is it a dev map key ? Is the application debuggable in the manifest ?
Sent from my Nexus One using XDA App
1. What do you mean by dev map key? Am using the debug.keystory MD5 hash that I feed into the google page http://code.google.com/android/add-ons/google-apis/maps-api-signup.html to get the apiKey.
2. The application is debbugable in the manifest.
Ok i see your files on computer now (not on android application on my nexus one)
replace com.google.android.maps.MapView by com.test.testmap.testMapActivity
If I replace it in main.xml the application crashes; in the manifest it does not compile
Help!
the:
<uses-permission android:name="android.permission.INTERNET" />
you have to put on <manifest>, not on <application>
like
<manifest ...>
<application ...>
<uses-library android:name="com.google.android.maps" />
.
.
.
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Other thing that I'm not totally right if it's correct:
I don't know if this is correct, but for me, only worked when I create a new Android Project with Target on Google API's. Didn't work with Android 2.2 + map.jar.
Did you create with Android X.X or Google API ?
I have tried to put the INTERNET permission inside and outside the application. It does not make a difference.
I am building a Google API application.
It worked.
Weird. I had to add
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
in <manifest> outside of <application> and did it through the "Permissions" tab in Eclipse.
Thanks.
Interesting, because I thought that the "ACCESS_FINE_LOCAT ION" is used only when you try to use something with location, such as get location, distance between locations, etc..., I thought that it's not necessary when you only want to show the map
Good to know, thank you
What does that mean ?! Here is the full error I get when submitting my proggy to the market;
ERRORS;
error#1- Market requires versionCode to be set to a positive 32-bit integer in AndroidManifest.xml
error#2- Market requires versionName to be set in AndroidManifest.xml
<><><><><><><><>
My Manifest; ( I replaced my app info with gen info for the forum)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mydomain.myapp"
android:versionCode="1"
android:versionName="1">
<uses-sdk android:minSdkVersion="7" />
<uses-sdk android:targetSdkVersion="8" />
<uses-sdk android:maxSdkVersion="9" />
<activity android:name=".myapp"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape">
<application android:label="@string/myapp" android:icon="@drawable/myicon">
<uses-feature android:name="android.hardware.touchscreen" android:required="true"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</application>
</activity>
</manifest>
<><><><><>
Any help would be wonderful, thanks taking the time to read this post
heres the starting of my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hyperbyte.app3"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
// etc...
But it won't allow for installs to the SD card. Any ideas?
I created gradient_drawable1.xml file and the eclipse is showing error that "failed to prase file gradient_drawable1.xml.
source code of gradient_drawable1.xml is
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:startColor="#4C4C43"
android:endColor="#B8B894"
android:angle="270" />
</shape>
</item>
</animation-list>
and exception stact trace are :
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
help !!
thanks..
sonidepanshu said:
I created gradient_drawable1.xml file and the eclipse is showing error that "failed to prase file gradient_drawable1.xml.
source code of gradient_drawable1.xml is
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:startColor="#4C4C43"
android:endColor="#B8B894"
android:angle="270" />
</shape>
</item>
</animation-list>
help !!
thanks..
Click to expand...
Click to collapse
why <animation-list xmlns:android="http://schemas.android.com/apk/res/android" > </animation-list> this would require animation properties, your missing "duration"
so maybe change "animation-list" to "layer-list"
Code:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:startColor="#4C4C43"
android:endColor="#B8B894"
android:angle="270" />
</shape>
</item>
</layer-list>
hope that helps, if it's not what you want let me know.
hi guys
could you help me to put the banner in my app.
I also followed the guides but I still can not insert
You might even see me lines of code please
thanks
what problem are you getting????
Atleast tell the problem or provide the code where you are facing problem.
Simple:
1) Install Google AdMob Ads SDK (you can use Android SDK Manager for that)
2) Add GoogleAdMobAdsSdk.jar to your project (Project Properties>>Java Build Path>>Add External JARs…)
3) In the Manifest add ACCESS_NETWORK_STATE and INTERNET permissions, and also an activity inside application tag, like that:
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".BillingSampleActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" />
</application>
4) Get Publisher ID from AdMob
5) Add banner to your layout
Code:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="your_admob_publisher_id"
ads:loadAdOnCreate="true" />
Thats it!
GRYMALA said:
Simple:
1) Install Google AdMob Ads SDK (you can use Android SDK Manager for that)
2) Add GoogleAdMobAdsSdk.jar to your project (Project Properties>>Java Build Path>>Add External JARs…)
3) In the Manifest add ACCESS_NETWORK_STATE and INTERNET permissions, and also an activity inside application tag, like that:
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".BillingSampleActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" />
</application>
4) Get Publisher ID from AdMob
5) Add banner to your layout
Code:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="your_admob_publisher_id"
ads:loadAdOnCreate="true" />
Thats it!
Click to expand...
Click to collapse
Nice answer! Thanks for this.