i have trying to get test ad on my device from last 3 weeks but still no ad.
plz help me .
my logcat details is:
01-04 14:09:22.099: D/WebView(1677): onSizeChanged - w:480 h:75
01-04 14:10:30.957: W/IInputConnectionWrapper(1677): getSelectedText on inactive InputConnection
01-04 14:10:30.957: W/IInputConnectionWrapper(1677): setComposingText on inactive InputConnection
01-04 14:10:56.782: D/dalvikvm(3437): GC_FOR_ALLOC freed 138K, 10% free 9738K/10759K, paused 23ms, total 23ms
01-04 14:10:56.922: D/dalvikvm(3437): GC_CONCURRENT freed 147K, 10% free 10109K/11143K, paused 2ms+4ms, total 131ms
01-04 14:10:56.922: D/dalvikvm(3437): WAIT_FOR_CONCURRENT_GC blocked 66ms
01-04 14:10:57.022: I/dalvikvm(3437): Could not find method android.webkit.WebSettings.getDefaultUserAgent, referenced from method com.google.android.gms.ads.internal.util.g.a
01-04 14:10:57.022: W/dalvikvm(3437): VFY: unable to resolve static method 3091: Landroid/webkit/WebSettings;.getDefaultUserAgent (Landroid/content/Context;)Ljava/lang/String;
01-04 14:10:57.022: D/dalvikvm(3437): VFY: replacing opcode 0x71 at 0x0011
01-04 14:10:57.112: D/dalvikvm(3437): GC_FOR_ALLOC freed 244K, 10% free 10392K/11527K, paused 16ms, total 16ms
01-04 14:10:57.232: I/webclipboard(3437): clipservice: android.sec.clipboard.ClipboardExManager#41e6c6e0
01-04 14:10:57.252: I/Ads(3437): Starting ad request.
01-04 14:10:57.252: I/Ads(3437): Use AdRequest.Builder.addTestDevice("11D834F405486C316220DC52A0BB7D6D") to get test ads on this device.
01-04 14:10:57.412: D/dalvikvm(3437): GC_CONCURRENT freed 193K, 10% free 10489K/11591K, paused 6ms+33ms, total 301ms
01-04 14:10:57.502: D/libEGL(3437): loaded /system/lib/egl/libGLES_hawaii.so
01-04 14:10:57.512: D/(3437): mem_init ++
01-04 14:10:57.512: D/(3437): gHwMemAllocator client 3
01-04 14:10:57.512: D/(3437): **** Using ION allocator ****
01-04 14:10:57.512: D/(3437): registered SIGUSR1[10] for pid[3437]
01-04 14:10:57.512: D/(3437): HwMemAllocatorImpl Static Counters 0 0
01-04 14:10:57.512: D/(3437): HwMemAllocatorImpl[4acdad5c] totalDeviceAllocSize[0] totalFree[0] maxFree[0] in numSlabs[0]
01-04 14:10:57.512: D/(3437): mem_init 4acdad5c--
01-04 14:10:57.512: D/ION(3437): config: version(0x10000) secure(0xf000) 256M(0x22d) fast(0x608) hwwr(0x608)
01-04 14:10:57.512: D/(3437): Waiting for mm thread to come up
01-04 14:10:57.512: D/(3437): mm_device_thread starting
01-04 14:10:57.522: D/HAWAII_EGL(3437): eglCreateContext() config: 35 context: 0x4d983e40, VC context 1, Thread 3437
01-04 14:10:57.522: D/HAWAII_EGL(3437): Set SWAP INTERVAL 0
01-04 14:10:57.522: D/HAWAII_EGL(3437): eglCreateWindowSurface() surface: 0x4d57beb8, VC surface: 1, Thread: 3437
01-04 14:10:57.522: D/HAWAII_EGL(3437): eglMakeCurrent(0x4d983e40, 0x4d57beb8, 0x4d57beb8) Thread: 3437
01-04 14:10:57.522: D/OpenGLRenderer(3437): Enabling debug mode 0
01-04 14:10:57.583: V/webkit(3437): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {41f6c018}
01-04 14:10:57.883: D/dalvikvm(3437): DexOpt: --- BEGIN 'ads1156133905.jar' (bootstrap=0) ---
01-04 14:10:58.183: D/dalvikvm(3437): DexOpt: --- END 'ads1156133905.jar' (success) ---
01-04 14:10:58.183: D/dalvikvm(3437): DEX prep '/data/data/com.example.myadtestapp/cache/ads1156133905.jar': unzip in 0ms, rewrite 299ms
01-04 14:11:00.986: W/Ads(3437): There was a problem getting an ad response. ErrorCode: 1
01-04 14:11:00.996: I/dalvikvm(3437): Could not find method android.webkit.WebSettings.setMediaPlaybackRequiresUserGesture, referenced from method com.google.android.gms.ads.internal.o.a.<init>
01-04 14:11:00.996: W/dalvikvm(3437): VFY: unable to resolve virtual method 3104: Landroid/webkit/WebSettings;.setMediaPlaybackRequiresUserGesture (Z)V
01-04 14:11:00.996: D/dalvikvm(3437): VFY: replacing opcode 0x6e at 0x004b
01-04 14:11:01.006: I/dalvikvm(3437): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.o.a.evaluateJavascript
01-04 14:11:01.016: W/dalvikvm(3437): VFY: unable to resolve virtual method 3114: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
01-04 14:11:01.016: D/dalvikvm(3437): VFY: replacing opcode 0x6f at 0x0016
01-04 14:11:01.036: V/webkit(3437): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {41fc54a0}
01-04 14:11:01.036: I/webclipboard(3437): clipservice: android.sec.clipboard.ClipboardExManager#41fc5bd8
01-04 14:11:01.086: W/Ads(3437): Failed to load ad: 1
and main.java is:
package com.example.myadtestapp;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.google.ads.AdSize;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView = (AdView) findViewById(R.id.adView);
// Request for Ads
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("4d08da7768519000")
.build();
adView.loadAd(adRequest);
}
and activity_main.xml is
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
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="com.example.myadtestapp.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adUnitId="ca-app-pub-1205981486869590/2185561060 "
ads:adSize="SMART_BANNER"/>
</RelativeLayout>
and my mainfest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myadtestapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<!-- Include required permissions for Google Mobile Ads to run-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".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>
<!--Include the AdActivity configChanges and theme. -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
</application>
</manifest>
plz help me to get out from this problem....
Remove padding from parent layout.
To be exact, remove below 4 lines in your xml.
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
As per the Google Mobile Ads documentation, "Failed to load ad: 1" means the ad unit ID was incorrect.
Get the proper add unit id. See: Create an ad unit
Related
I use Eclipse with ADT, I tried to show admob banners with Google Play Services in Google Ads Sample but it show "Internal Error".
Internet work, I have google-play-services_lib rev 22 included in project.
I have tried in another phone but same thing.
LogCat:
01-25 09:19:01.795: W/GooglePlayServicesUtil(14429): Google Play services out of date. Requires 6587000 but found 5089030
01-25 09:19:01.845: D/dalvikvm(14429): GC_CONCURRENT freed 864K, 18% free 4349K/5248K, paused 4ms+3ms, total 39ms
01-25 09:19:01.865: W/GooglePlayServicesUtil(14429): Google Play services out of date. Requires 6587000 but found 5089030
01-25 09:19:01.885: I/Ads(14429): Starting ad request.
01-25 09:19:01.936: I/Ads(14429): Please set theme of AdActivity to #android:style/Theme.Translucent to enable transparent background interstitial ad.
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 11
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 12
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 13
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 14
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 15
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 16
01-25 09:19:02.105: I/dalvikvm(14429): Total arena pages for JIT: 17
01-25 09:19:02.265: I/dalvikvm(14429): Total arena pages for JIT: 18
01-25 09:19:02.915: D/dalvikvm(14429): DexOpt: --- BEGIN 'ads-1030805842.jar' (bootstrap=0) ---
01-25 09:19:03.046: D/dalvikvm(14429): DexOpt: --- END 'ads-1030805842.jar' (success) ---
01-25 09:19:03.046: D/dalvikvm(14429): DEX prep '/data/data/com.google.android.gms.samples.ads/cache/ads-1030805842.jar': unzip in 1ms, rewrite 137ms
01-25 09:19:03.115: W/GooglePlayServicesUtil(14429): Google Play services out of date. Requires 6587000 but found 5089030
01-25 09:19:03.115: E/GooglePlayServicesUtil(14429): GooglePlayServices not available due to error 2
01-25 09:19:03.315: I/dalvikvm(14429): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.internal.gu.evaluateJavascript
01-25 09:19:03.315: W/dalvikvm(14429): VFY: unable to resolve virtual method 8193: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
01-25 09:19:03.315: D/dalvikvm(14429): VFY: replacing opcode 0x6f at 0x0016
01-25 09:19:04.175: W/Ads(14429): JS: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
01-25 09:19:04.175: W/Ads(14429): (null:1)
01-25 09:19:04.175: W/Web Console(14429): The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
01-25 09:19:04.175: W/Web Console(14429): at null:1
01-25 09:19:04.526: E/Ads(14429): JS: Uncaught ReferenceError: AFMA_buildAdURL is not defined (null:1)
01-25 09:19:04.526: E/Web Console(14429): Uncaught ReferenceError: AFMA_buildAdURL is not defined at null:1
01-25 09:19:13.316: D/webviewglue(14429): nativeDestroy view: 0x2a377dc8
01-25 09:19:13.335: W/Ads(14429): There was a problem getting an ad response. ErrorCode: 0
01-25 09:19:13.345: D/dalvikvm(14429): GC_CONCURRENT freed 519K, 17% free 4405K/5248K, paused 5ms+5ms, total 36ms
01-25 09:19:13.375: W/Ads(14429): Failed to load ad: 0
Mannifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms.samples.ads"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<!-- Used to request banner and interstitial ads. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Used to avoid sending an ad request if there is no connectivity. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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="#integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.samples.ads.GoogleAdsSampleActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".BannerXmlActivity"
android:label="#string/banner_in_xml"/>
<activity android:name=".BannerCodeActivity"
android:label="#string/banner_in_code"/>
<activity android:name=".InterstitialActivity"
android:label="#string/interstitial"/>
<!-- Activity required to show ad overlays. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
Project-Property:
target=android-21
android.library.reference.1=../google-play-services_lib
Java Code:
mAdView = new AdView(this);
mAdView.setAdUnitId("ca-app-pub-8xxxxxxxxxxxxxxx/4xxxxxxxxx");
mAdView.setAdSize(AdSize.BANNER);
final RelativeLayout layout = (RelativeLayout) findViewById(R.id.mainLayout);
layout.addView(mAdView);
mAdView.setAdListener(new ToastAdListener(this));
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("AAxAxxxAxAxxxAxxxAxxxAAxxAxxxAA")
.build();
mAdView.loadAd(adRequest);
If I must update Google Play Services on my phone, I don't know how because Google Play Store doesn't show Google Play Services.
Check if you imported library for ads
Check if you created internal ads in your ADMob account
Check if you have API 9 or higher on your mobile phone (if you have API 8 or lower it won't work because API 8 doesn't support Google Play services any more)
Then try this code:
Toast toast = new Toast(this);
toast.setView(ads);
toast.show();
you need to call toast.show in your main activity or it won't work.
I have added AdMob banner into my application according to a how-to. But banner is never shown, i have made this the same way i did with another app and everything works perfectly. Cannot find a solution, checked all the related Stack questions, nothing works:(
I use a correct publisher id and i have added GoogleAdMobAdsSdk-6.4.1.jar
My xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
android:orientation="vertical"
tools:context=".MainActivity" >
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_gravity="center_vertical"
android:layout_weight="0.80" >
</ListView>
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="pub_id"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
</LinearLayout>
My manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.luckyyou.greatlaces"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.luckyyou.greatlaces.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>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize| smallestScreenSize"/>
<activity
android:name="com.luckyyou.greatlaces.tab1"
android:label="#string/name1"
android:theme="#android:style/Theme.Dialog"
android:screenOrientation="portrait"> </activity>
...
<activity
android:name="com.luckyyou.greatlaces.tab12"
android:label="#string/name12"
android:theme="#android:style/Theme.Dialog"
android:screenOrientation="portrait">
</activity>
</application>
</manifest>
Here what LogCat says:
01-08 14:21:52.778: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 52K, 51% free 2674K/5379K, external 1527K/1559K, paused 242ms
01-08 14:21:55.431: ERROR/ActivityThread(1804): Failed to find provider info for com.google.plus.platform
01-08 14:21:55.518: INFO/Ads(1804): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
01-08 14:21:55.858: DEBUG/dalvikvm(1804): DexOpt: --- BEGIN 'ads-143252855.jar' (bootstrap=0) ---
01-08 14:21:56.198: DEBUG/dalvikvm(1818): DexOpt: load 64ms, verify+opt 75ms
01-08 14:21:56.378: DEBUG/dalvikvm(1804): DexOpt: --- END 'ads-143252855.jar' (success) ---
01-08 14:21:56.378: DEBUG/dalvikvm(1804): DEX prep '/data/data/com.luckyyou.greatlaces/cache/ads-143252855.jar': unzip in 34ms, rewrite 520ms
01-08 14:21:56.378: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 217K, 50% free 2876K/5639K, external 2151K/2316K, paused 140ms
01-08 14:21:56.388: DEBUG/webviewglue(1804): nativeDestroy view: 0x91621b8
01-08 14:21:56.748: INFO/Ads(1804): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"9030672260837145206","seq_num":"1","slotname":"pub_id","u_w":320,"msid":"com.luckyyou.greatlaces","cap":"m,a","js":"afma-sdk-a-v6.4.1","bas_off":0,"net":"ed","app_name":"1.android.com.luckyyou.greatlaces","hl":"en","gnt":3,"carrier":"310260","u_audio":4,"kw":[],"u_sd":1.5,"simulator":1,"ms":"aESYziECsoJ_gzwNWoDn5OQjNPknVakDj2SrrKXxrOZsEWD6r4wsETa7CzeB3sCAwMmoFdWVd-PB3S-s381WQrdDEK_k05alE8tfJmkHWXNzJkS-Xql-6WqEEAgBc0-8cSp08YlmRv0xjgqH5yKehnOHMtOonYftI2DXsmFuMAwdjIOmWmCYaT7BjDQDlUzULzTvZRe6EvgSgalmiK-4Wfem4vJyo-QXzVRVG5Ng0WRcCebjE0LIulSyCsQyngqLWg2VhqUfHzGfiru4NxSUYV3GvxksLLXeShEv8X00-c629-Loha16sjyWYc0ecQ9gerTls_FvObQwTYyTb3jqRg","isu":"B3EEABB8EE11C2BE770B684D95219ECB","format":"320x50_mb","oar":0,"ad_pos":{"height":0,"visible":0,"y":76,"x":0,"width":0},"u_h":533,"pt":1,"bas_on":0,"ptime":0});</script></head><body></body></html>
01-08 14:21:56.918: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 128K, 49% free 2886K/5639K, external 2438K/3005K, paused 108ms
01-08 14:21:57.550: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed <1K, 49% free 2885K/5639K, external 4395K/5489K, paused 126ms
01-08 14:21:58.507: DEBUG/gralloc_goldfish(1804): Emulator without GPU emulation detected.
01-08 14:21:59.218: INFO/ActivityManager(858): Displayed com.luckyyou.greatlaces/.MainActivity: +7s494ms
01-08 14:22:00.818: WARN/webcore(1804): Can't get the viewWidth after the first layout
01-08 14:22:00.998: WARN/Ads(1804): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
01-08 14:22:00.998: DEBUG/webviewglue(1804): nativeDestroy view: 0x915dbd0
01-08 14:22:01.008: INFO/Ads(1804): onFailedToReceiveAd(Invalid Ad request.)
01-08 14:22:05.238: DEBUG/dalvikvm(1131): GC_EXPLICIT freed 9K, 52% free 2662K/5511K, external 1527K/1559K, paused 149ms
These look to be the relevant lines in the log.
Since your layout looks OK I suspect that you have do something funky in the theme you have applied for the application that is causing confusion with the view width. Review your #style/AppTheme config.
01-08 14:22:00.818: WARN/webcore(1804): Can't get the viewWidth after the first layout
01-08 14:22:00.998: WARN/Ads(1804): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
The final thing: You said you are using Admob-6.4.1. Are you also using thge GooglePlayServices library? If so you might have inadvertently used some of the Admob classes from GPS. If this is the case then I suggest removing Admob-6.4.1 and going 100% with GPS.
I am tring to implement google maps using the new google maps api v2 and for some reason i don't see a map.
I think that the problem is those two lines of error when i run it on the emulator:
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
when i run the application on the device the following error is produced:
Could not find class 'maps.j.k', referenced from method map.y.ae.a
My problem looks the same as in this link: http://android-er.blogspot.co.il/2012/12/google-maps-android-api-v2-with-blank.html
There it's says that the problem may be my key so i went and reproduced it using the following tutorial: http://android-er.blogspot.co.il/2012/12/displaying-sha1-certificate-fingerprint.html. but this still didn't helped me.
the support files are of course add to the project as well as the Google play services lib.
I see the same result on the emulator (after adding manually the two file that allow using the google map v2 on the emulator) as well as on the motorola Defy running android 2.2.
Maybe I am using the wrong debug.keystore? I am using the one in my User.android folder.If so then how do i find the right file?
EDIT: My eclipse says that my debug key is in the default folder. So i renamed the debug.keystore file and ran the Eclipse to recreate it all over again. That resulted in producing a new SHA1 key. I used it to create a new Google Maps API v2 key but the result is still the same. I'm still unable to see the map.
EDIT2: Stupid me, I chose Google Map API V2 instead of Google Maps Android API V2.
This question can be closed. Thanks.
Here are all the code files:
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:cameraBearing="112.5"
map:cameraTargetLat="-33.796923"
map:cameraTargetLng="150.922433"
map:cameraTilt="30"
map:cameraZoom="13"
map:mapType="normal"
map:uiCompass="false"
map:uiRotateGestures="true"
map:uiScrollGestures="false"
map:uiTiltGestures="true"
map:uiZoomGestures="true" />
</LinearLayout>
Map Fragmentactivity class:
package com.eadesign.skygiraffefinalv2;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import android.os.Bundle;
import com.google.android.gms.maps.*;
import android.widget.ImageView;
import android.widget.TextView;
public class Map extends android.support.v4.app.FragmentActivity
{
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()) == 0)
{
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
// map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
}}
manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eadesign.skygiraffefinalv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<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/sgicon90"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<activity
android:name=".Map"
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="My key"/>
</application>
log from logcat:
ent.category.LAUNCHER] flg=0x10000000 cmp=com.eadesign.skygiraffefinalv2/.Map u=
0} from pid 1362
W/WindowManager( 148): Failure taking screenshot for (246x410) to layer 21010
D/AndroidRuntime( 1362): Shutting down VM
I/ActivityManager( 148): Start proc com.eadesign.skygiraffefinalv2 for activity
com.eadesign.skygiraffefinalv2/.Map: pid=1373 uid=10046 gids={3003, 1015, 1028}
D/dalvikvm( 1373): Not late-enabling CheckJNI (already on)
D/dalvikvm( 1362): GC_CONCURRENT freed 99K, 77% free 483K/2048K, paused 1ms+1ms,
total 13ms
D/jdwp ( 1362): Got wake-up signal, bailing out of select
D/dalvikvm( 1362): Debugger has detached; object registry had 1 entries
E/jdwp ( 1373): Failed sending reply to debugger: Broken pipe
D/dalvikvm( 1373): Debugger has detached; object registry had 2 entries
E/Trace ( 1373): error opening trace file: No such file or directory (2)
D/dalvikvm( 1373): GC_CONCURRENT freed 204K, 3% free 8264K/8519K, paused 89ms+6m
s, total 161ms
D/dalvikvm( 1373): WAIT_FOR_CONCURRENT_GC blocked 33ms
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
D/dalvikvm( 1373): GC_CONCURRENT freed 312K, 5% free 8471K/8839K, paused 82ms+10
5ms, total 268ms
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
D/dalvikvm( 1373): GC_CONCURRENT freed 227K, 4% free 8797K/9095K, paused 91ms+11
0ms, total 300ms
D/libEGL ( 1373): Emulator without GPU support detected. Fallback to software r
enderer.
I/Choreographer( 1373): Skipped 54 frames! The application may be doing too muc
h work on its main thread.
D/gralloc_goldfish( 1373): Emulator without GPU emulation detected.
D/libEGL ( 1373): loaded /system/lib/egl/libGLES_android.so
I/ActivityManager( 148): Displayed com.eadesign.skygiraffefinalv2/.Map: +3s545ms
I/Choreographer( 1373): Skipped 75 frames! The application may be doing too muc
h work on its main thread.
In my case I chose Google Maps API V2 instead of Google Maps Android API V2. After changing that the problem was gone. So this code is perfectly fine to create a full screen Google map and the question can be closed.
Thanks.
I am testing the sample google code on an actual device having 2.3.6.I thought it might be the problem with the key ,so I created different key on a different account through Google's API Console.Still the same problem "Google Maps Android API-Authorization Failure".
Here is the log:
12-07 10:31:30.476: D/dalvikvm(17791): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
12-07 10:31:30.484: W/dalvikvm(17791): VFY: unable to resolve instance field 24
12-07 10:31:30.484: D/dalvikvm(17791): VFY: replacing opcode 0x52 at 0x0012
12-07 10:31:30.484: D/dalvikvm(17791): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
12-07 10:31:30.718: D/dalvikvm(17791): GC_CONCURRENT freed 197K, 46% free 3063K/5639K, external 408K/517K, paused 3ms+4ms
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/a/du; (411)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/a/du;' failed
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/a/ej; (2363)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/a/ej;' failed
12-07 10:31:30.789: W/dalvikvm(17791): Unable to resolve superclass of Lmaps/j/k; (2379)
12-07 10:31:30.789: W/dalvikvm(17791): Link of class 'Lmaps/j/k;' failed
12-07 10:31:30.789: E/dalvikvm(17791): Could not find class 'maps.j.k', referenced from method maps.y.ae.a
12-07 10:31:30.789: W/dalvikvm(17791): VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
12-07 10:31:30.789: D/dalvikvm(17791): VFY: replacing opcode 0x22 at 0x007d
12-07 10:31:30.820: D/dalvikvm(17791): VFY: dead code 0x007f-008f in Lmaps/y/ae;.a (Landroid/view/LayoutInflater;Lcom/google/android/gms/maps/GoogleMapOptions;Z)Lmaps/y/ae;
12-07 10:31:31.281: D/dalvikvm(17791): GC_CONCURRENT freed 297K, 46% free 3222K/5959K, external 408K/517K, paused 3ms+4ms
12-07 10:31:31.523: D/dalvikvm(17791): GC_EXTERNAL_ALLOC freed 227K, 45% free 3397K/6087K, external 431K/517K, paused 52ms
12-07 10:31:31.648: I/System.out(17791): 0
12-07 10:31:31.734: D/dalvikvm(17791): GC_CONCURRENT freed 188K, 43% free 3531K/6151K, external 544K/1029K, paused 5ms+4ms
12-07 10:31:32.125: D/libEGL(17791): loaded /system/lib/egl/libGLES_hgl.so
12-07 10:31:32.132: D/BRCM_EGL(17791): eglCreateContext() context: 0xd7090, VC context 1, Thread 17810
12-07 10:31:32.148: D/BRCM_EGL(17791): eglCreateWindowSurface() surface: 0xd70d0, VC surface: 1, Thread: 17810
12-07 10:31:32.148: D/BRCM_EGL(17791): eglMakeCurrent(0xd7090, 0xd70d0, 0xd70d0) Thread: 17810
12-07 10:31:32.859: E/Google Maps Android API(17791): Authorization failure.
Here's is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smartapps4u.googlemapslib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission
android:name="com.smartapps4u.googlemapslib.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.smartapps4u.googlemapslib.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-library android:name="com.google.android.maps" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My API key"/>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Any help would be appreciated.
Solved it.Very stupid mistake on my part.Used wrong api key.Was using the api key for the signed app.Replaced it with api key for debug keystore and solved the problem.
Had the same problem and #Sunkenglory 's answer is right, just to add some info for newbies like myself when I was looking for a solution.
On mac osX, my debug keystore was located here:
~/.android/debug.keystore
Go to that folder and run the following
keytool -list -v -keystore debug.keystore
That gave me the correct sha1 that I entered in the google console, and now it works.
I have downloaded a fresh copy of Phonegap/Cordova to see why my application continually throws some errors.
I followed the "getting started" from Phonegap and ended up with Hello World working on my device (HTC DesireHD with Android 2.3.3).
So this application does nothing as such, just prints hello world on the device.
The application works which is great however I get some unpleasant error messages in my Logs:
Specifically:
09-06 17:26:31.487: E/dalvikvm(32594): Could not find class
'android.webkit.WebResourceResponse', referenced from method
org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse
09-06 17:26:31.487: W/dalvikvm(32594): VFY: unable to resolve
new-instance 452 (Landroid/webkit/WebResourceResponse;) in
Lorg/apache/cordova/CordovaWebViewClient;
I then get other related errors repeating.
I repeat that the application works but I would really like not to see any errors in the logs :-)
Other people have mentioned that it might be due to the name of my libs folder (it is correctly named libs with the "s")
I have included below copies of my AndroidManifest.xml, my MainActivity.java and the complete LogCat.
I am using Win7, Eclipse 3.8.
Thanks very much for any help.
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qwentes.phonegaptest" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="15" />
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:name=".MainActivity" android:label="#string/title_activity_main" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package com.qwentes.phonegaptest;
import android.os.Bundle;
import org.apache.cordova.*;
public class MainActivity extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
LogCat.txt
09-06 17:26:29.265: I/dalvikvm(32594): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
09-06 17:26:29.265: W/dalvikvm(32594): VFY: unable to resolve direct method 3117: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
09-06 17:26:29.265: D/dalvikvm(32594): VFY: replacing opcode 0x70 at 0x0001
09-06 17:26:29.265: D/dalvikvm(32594): VFY: dead code 0x0004-0059 in Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
09-06 17:26:29.705: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webview.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
09-06 17:26:29.705: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webview.db, mode: delete, disk free size: 554 M, handle: 0x34d960
09-06 17:26:30.606: V/webviewdatabase(32594): TCP pre connection: creating table in database
09-06 17:26:30.897: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webviewCache.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
09-06 17:26:30.897: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webviewCache.db, mode: delete, disk free size: 554 M, handle: 0x372128
09-06 17:26:31.467: D/skia(32594): htcFlashPlugin::htcFlashPlugin
09-06 17:26:31.477: D/qct(32594): [WebView.WebView] >> Enable Shutdown = true
09-06 17:26:31.477: I/CordovaLog(32594): Changing log level to DEBUG(3)
09-06 17:26:31.477: I/CordovaLog(32594): Found preference for useBrowserHistory=false
09-06 17:26:31.477: D/CordovaLog(32594): Found preference for useBrowserHistory=false
09-06 17:26:31.487: E/dalvikvm(32594): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse
09-06 17:26:31.487: W/dalvikvm(32594): VFY: unable to resolve new-instance 452 (Landroid/webkit/WebResourceResponse;) in Lorg/apache/cordova/CordovaWebViewClient;
09-06 17:26:31.487: D/dalvikvm(32594): VFY: replacing opcode 0x22 at 0x0046
09-06 17:26:31.487: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.487: D/dalvikvm(32594): VFY: dead code 0x0048-004c in Lorg/apache/cordova/CordovaWebViewClient;.generateWebResourceResponse (Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.527: I/dalvikvm(32594): Could not find method android.webkit.WebViewClient.shouldInterceptRequest, referenced from method org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to resolve virtual method 3129: Landroid/webkit/WebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: D/dalvikvm(32594): VFY: replacing opcode 0x6f at 0x0015
09-06 17:26:31.527: D/dalvikvm(32594): VFY: dead code 0x0018-0019 in Lorg/apache/cordova/CordovaWebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: D/DroidGap(32594): DroidGap.init()
09-06 17:26:31.547: D/CordovaWebView(32594): >>> loadUrl(file:///android_asset/www/index.html)
09-06 17:26:31.547: D/PluginManager(32594): init()
09-06 17:26:31.547: D/CordovaWebView(32594): >>> loadUrlNow()
09-06 17:26:31.587: D/ATRecorder(32594): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader#4053e810
09-06 17:26:31.597: D/WindowManagerImpl(32594): addView, new view, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView#4053ada8
09-06 17:26:31.597: D/SoftKeyboardDetect(32594): Ignore this event
09-06 17:26:31.687: W/webcore(32594): Not supported in this case.
09-06 17:26:31.687: D/SoftKeyboardDetect(32594): Ignore this event
09-06 17:26:31.817: D/qct(32594): [RequestQueue.ActivePool.ActivePool] >> Enable Shutdown = true
09-06 17:26:31.817: D/qct(32594): [IdleCache.IdleCache] >> IDLE_CACHE_MAX = 40
09-06 17:26:32.418: D/DroidGap(32594): onMessage(onPageStarted,file:///android_asset/www/index.html)
09-06 17:26:32.558: D/szipinf(32594): Initializing inflate state
09-06 17:26:32.558: D/szipinf(32594): Initializing zlib to inflate
09-06 17:26:32.618: D/webkit-timers(32594): [JWebCoreJavaBridge::resume] >> do resume
09-06 17:26:32.738: D/dalvikvm(32594): GC_CONCURRENT freed 134K, 44% free 3208K/5639K, external 0K/0K, paused 2ms+20ms
09-06 17:26:33.729: D/Cordova(32594): onPageFinished(file:///android_asset/www/index.html)
09-06 17:26:33.729: D/CordovaWebView(32594): >>> loadUrlNow()
09-06 17:26:33.729: D/DroidGap(32594): onMessage(onNativeReady,null)
09-06 17:26:33.729: D/DroidGap(32594): onMessage(onPageFinished,file:///android_asset/www/index.html)
09-06 17:26:34.030: I/Database(32594): sqlite returned: error code = 14, msg = cannot open file at line 27206 of [42537b6056]
09-06 17:26:34.190: D/DroidGap(32594): onMessage(networkconnection,wifi)
09-06 17:26:34.230: D/DroidGap(32594): onMessage(spinner,stop)
09-06 17:26:35.741: D/DroidGap(32594): onMessage(spinner,stop)
09-06 17:26:44.430: D/dalvikvm(32594): GC_CONCURRENT freed 376K, 46% free 3284K/6023K, external 0K/0K, paused 2ms+3ms
09-06 17:27:34.619: D/dalvikvm(32594): GC_FOR_MALLOC freed 586K, 50% free 3133K/6151K, external 0K/0K, paused 43ms
09-06 17:28:04.808: D/dalvikvm(32594): GC_CONCURRENT freed 357K, 48% free 3208K/6151K, external 0K/0K, paused 6ms+3ms
There is nothing you can do about those nasty logs in 2.0.0 but they will go away in 2.1.0 which should be out within the week. They are fixed by this commit:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=commit;h=07439ff99ca5f61c444ae7673d9fec96e4502492