Android Flurry test ad not being displayed - android

I am tring to integrate flurry test ads but the method setEnableTestAds throws a compilation error-- "the methods is undefined for FlurryAdBanner"
i comment this part and try to fetch and display ads but i do not see any ads in the emulator.
I am following this link.
My code-
private RelativeLayout mBanner;
private FlurryAdBanner mFlurryAdBanner = null;
private String mAdSpaceName = "BANNER_ADSPACE";
private String adspace = "BANNER_BOTTOM";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
FlurryAgent.init(this, Constants.FLURRY_KEY);
}
#Override
protected void onStart() {
super.onStart();
FlurryAgent.onStartSession(this, Constants.FLURRY_KEY);
//Flurry Ads
mBanner = (RelativeLayout)findViewById(R.id.flurry_banner);
mFlurryAdBanner = new FlurryAdBanner(this, mBanner, mAdSpaceName);
//FlurryAgent.logEvent("Pic taken");
// fetch and display ad for this ad space as soon as it is ready.
//mFlurryAdBanner.fetchAd();
mFlurryAdBanner.fetchAndDisplayAd();
// mFlurryAdBanner.setEnableTestAds(true);
}
My console messsages---
12-23 11:54:16.034: E/FlurryAgent(2069): There is a problem with the Google Play Services library, which is required for Android Advertising ID support. The Google Play Services library should be integrated in any app shipping in the Play Store that uses analytics or advertising.
12-23 11:54:16.454: D/dalvikvm(2069): GC_FOR_ALLOC freed 252K, 10% free 2913K/3224K, paused 40ms, total 43ms
12-23 11:54:16.734: W/FlurryAgent(2069): Flurry session created for context:XXX.activity.BaseActivity#b3ff2710
12-23 11:54:16.874: I/dalvikvm(2069): Failed resolving Lcom/flurry/sdk/bp; interface 1225 'Lcom/facebook/ads/AdListener;'
12-23 11:54:16.874: W/dalvikvm(2069): Link of class 'Lcom/flurry/sdk/bp;' failed
12-23 11:54:16.884: E/dalvikvm(2069): Could not find class 'com.flurry.sdk.bp', referenced from method com.flurry.sdk.bq.a
12-23 11:54:16.884: W/dalvikvm(2069): VFY: unable to resolve new-instance 1366 (Lcom/flurry/sdk/bp;) in Lcom/flurry/sdk/bq;
12-23 11:54:16.884: D/dalvikvm(2069): VFY: replacing opcode 0x22 at 0x000a
12-23 11:54:16.884: I/dalvikvm(2069): Failed resolving Lcom/flurry/sdk/br; interface 1230 'Lcom/facebook/ads/InterstitialAdListener;'
12-23 11:54:16.884: W/dalvikvm(2069): Link of class 'Lcom/flurry/sdk/br;' failed
12-23 11:54:16.884: E/dalvikvm(2069): Could not find class 'com.flurry.sdk.br', referenced from method com.flurry.sdk.bq.a
12-23 11:54:16.884: W/dalvikvm(2069): VFY: unable to resolve new-instance 1368 (Lcom/flurry/sdk/br;) in Lcom/flurry/sdk/bq;
12-23 11:54:16.884: D/dalvikvm(2069): VFY: replacing opcode 0x22 at 0x0008
12-23 11:54:16.894: I/dalvikvm(2069): Failed resolving Lcom/flurry/sdk/bp; interface 1225 'Lcom/facebook/ads/AdListener;'
12-23 11:54:16.894: W/dalvikvm(2069): Link of class 'Lcom/flurry/sdk/bp;' failed
12-23 11:54:16.894: D/dalvikvm(2069): DexOpt: unable to opt direct call 0x28c0 at 0x0c in Lcom/flurry/sdk/bq;.a
12-23 11:54:16.944: I/dalvikvm(2069): Failed resolving Lcom/flurry/sdk/br; interface 1230 'Lcom/facebook/ads/InterstitialAdListener;'
12-23 11:54:16.994: W/dalvikvm(2069): Link of class 'Lcom/flurry/sdk/br;' failed
12-23 11:54:16.994: D/dalvikvm(2069): DexOpt: unable to opt direct call 0x28d6 at 0x0a in Lcom/flurry/sdk/bq;.a
12-23 11:54:17.024: V/WebViewChromium(2069): Binding Chromium to the main looper Looper (main, tid 1) {b3fb94a8}
12-23 11:54:17.064: I/chromium(2069): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
12-23 11:54:17.104: I/BrowserProcessMain(2069): Initializing chromium process, renderers=0
12-23 11:54:17.394: E/chromium(2069): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
12-23 11:54:17.394: E/chromium(2069): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
12-23 11:54:17.394: E/chromium(2069): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
12-23 11:54:17.404: E/chromium(2069): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
12-23 11:54:17.404: E/chromium(2069): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
12-23 11:54:17.474: W/FlurryAgent(2069): Flurry session started for context:XXX.activity.BaseActivity#b3ff2710
12-23 11:54:17.484: W/chromium(2069): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
12-23 11:54:38.524: W/FlurryAgent(2069): **Analytics report sent.**
12-23 11:54:40.764: E/FlurryAgent(2069): Ad server responded with the following error(s):
12-23 11:54:40.764: E/FlurryAgent(2069): **Unknown Api Key**

Unfortunately, Ad Test Mode is currently having issues and only works with Gemini Video ads at this time. At this point we do not believe the issue is with your integration. The error just means that the ad is unfilled, and we expect the fill rate to improve going forward.
Not sure, but haven't improved since this mail for me.

The log is very clear: you have not provided the API key corresponding to your app. You can found it on dev.flurry.com

Related

Exoplayer decoder init failed when playing Admob reward videos

I'm testing reward videos from Admob and I'm getting the error bellow.
The code is correct because it works on a Samsung S7.
The error accurs when running on a Samsung S3 mini with Jelly Bean 4.3.1.
I/Ads: Starting ad request.
I/Ads: This request is sent from a test device.
I/ExoPlayerImpl: Init 1.3.1
I/dalvikvm: Could not find method android.media.MediaCodec.releaseOutputBuffer, referenced from method com.google.android.gms.ads.exoplayer1.ab.a
W/dalvikvm: VFY: unable to resolve virtual method 2135: Landroid/media/MediaCodec;.releaseOutputBuffer (IJ)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x007d
I/dalvikvm: Could not find method android.media.AudioTrack.write, referenced from method com.google.android.gms.ads.exoplayer1.l.a
W/dalvikvm: VFY: unable to resolve virtual method 2114: Landroid/media/AudioTrack;.write (Ljava/nio/ByteBuffer;II)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x01cb
I/dalvikvm: Could not find method android.media.MediaCodecInfo$CodecCapabilities.isFeatureSupported, referenced from method com.google.android.gms.ads.exoplayer1.v.a
W/dalvikvm: VFY: unable to resolve virtual method 2147: Landroid/media/MediaCodecInfo$CodecCapabilities;.isFeatureSupported (Ljava/lang/String;)Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x001a
I/OMXClient: Using client-side OMX mux.
E/dalvikvm: Could not find class 'android.media.MediaCodec$CodecException', referenced from method com.google.android.gms.ads.exoplayer1.t.<init>
W/dalvikvm: VFY: unable to resolve instanceof 508 (Landroid/media/MediaCodec$CodecException;) in Lcom/google/android/gms/ads/exoplayer1/t;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x003d
W/Ads: ExoPlayer failed during precache: DecoderInitializationError Exception: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
E/ExoPlayerImplInternal: Internal track renderer error.
com.google.android.gms.ads.exoplayer1.d: com.google.android.gms.ads.exoplayer1.t: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
...
W/Ads: ExoPlayer failed during precache: PlayerError Exception: com.google.android.gms.ads.exoplayer1.t: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
W/Ads: Failed to preload url gcache://video/media/8744318498482049952?url=https://www.youtube.com/get_video%3Fvideo_id%3DeVoPWFDmU6A%26ts%3D1527455824%26t%3D0xl-clkGaPYoJY-TQD0kRV3-cVE%26gad%3D1%26br%3D1%26itag%3D18&tag.duration=5000&tag.check_url=https://www.youtube.com/get_video%3Fvideo_id%3DeVoPWFDmU6A%26ts%3D1527455824%26t%3D0xl-clkGaPYoJY-TQD0kRV3-cVE%26gad%3D1%26br%3D1%26itag%3D18 Exception: Abort requested before buffering finished.
W/Ads: Failed to load ad: 0
W/Ads: Failed to load ad: 3
First I thought it could be the version of Exoplayer (1.3.1) which is a bit outdated, but then I've tried to run the exoplayer demo and it looks like my device doesn't have the right decoder:
I/ExoPlayerImpl: Init 424158b8 [ExoPlayerLib/2.8.1] [golden, GT-I8190, samsung, 18]
W/IMASDK: Invalid internal message, ignoring. Please make sure the Google IMA SDK library is up to date. Message: gmsg://afma.google.com/activityMonitor?type=getPageSignals&sid=649203f5-e3fb-4dae-ae2c-e98f4a0e4a0e&dt=1527458767639
I/OMXClient: Using client-side OMX mux.
E/MediaCodecUtil: Failed to query codec OMX.ST.aac.decoder (audio/mp4a-latm)
E/ExoPlayerImplInternal: Playback error.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.supportsFormat(MediaCodecRenderer.java:302)
at com.google.android.exoplayer2.trackselection.MappingTrackSelector.findRenderer(MappingTrackSelector.java:435)
at com.google.android.exoplayer2.trackselection.MappingTrackSelector.selectTracks(MappingTrackSelector.java:344)
at com.google.android.exoplayer2.MediaPeriodHolder.selectTracks(MediaPeriodHolder.java:162)
at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:143)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:1507)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:316)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecUtil$DecoderQueryException: Failed to query underlying media codecs
at com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getDecoderInfosInternal(MediaCodecUtil.java:281)
at com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getDecoderInfos(MediaCodecUtil.java:150)
My build.gradle
compileSdkVersion 27
defaultConfig {
applicationId "com.test.app"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "test reward videos"
}
So my question is, how can I add the missing decoder?

DB didn't get created in Cordova

I have problem with my first application in Android Studio-Cordova.
I used for my application html,css, jquery and sql.
The application is correct, because I'm attending an on-line course with related code.
It starts, but the message of creating db isn't appeared.
the log of Android Studio is this:
Client not ready yet..Waiting for process to come online
Connected to process 2679 on device Nexus_5_API_19_armeabi_v7a [emulator-5554]
I/InstantRun: Instant Run Runtime started. Android package is com.videocorsi.test, real application class is null.
W/InstantRun: No instant run dex files added to classpath
I/CordovaLog: Changing log level to DEBUG(3)
I/CordovaActivity: Apache Cordova native platform version 6.0.0 is starting
D/CordovaActivity: CordovaActivity.onCreate()
I/dalvikvm: Could not find method android.app.Activity.checkSelfPermission, referenced from method org.apache.cordova.CordovaInterfaceImpl.hasPermission
W/dalvikvm: VFY: unable to resolve virtual method 2: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0023
I/dalvikvm: Could not find method android.app.Activity.requestPermissions, referenced from method org.apache.cordova.CordovaInterfaceImpl.requestPermissions
W/dalvikvm: VFY: unable to resolve virtual method 136: Landroid/app/Activity;.requestPermissions ([Ljava/lang/String;I)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0029
V/WebViewChromium: Binding Chromium to the background looper Looper (main, tid 1) {9dd95220}
I/chromium: [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain: Initializing chromium process, renderers=0
W/chromium: [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
D/dalvikvm: GC_FOR_ALLOC freed 142K, 12% free 3463K/3892K, paused 86ms, total 88ms
I/dalvikvm-heap: Grow heap (frag case) to 6.078MB for 2536936-byte allocation
D/dalvikvm: GC_FOR_ALLOC freed 0K, 7% free 5941K/6372K, paused 58ms, total 58ms
I/dalvikvm: Could not find method android.webkit.CookieManager.setAcceptThirdPartyCookies, referenced from method org.apache.cordova.engine.SystemCookieManager.<init>
W/dalvikvm: VFY: unable to resolve virtual method 953: Landroid/webkit/CookieManager;.setAcceptThirdPartyCookies (Landroid/webkit/WebView;Z)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0046
I/dalvikvm: Could not find method android.webkit.CookieManager.flush, referenced from method org.apache.cordova.engine.SystemCookieManager.flush
W/dalvikvm: VFY: unable to resolve virtual method 947: Landroid/webkit/CookieManager;.flush ()V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0019
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/ClientCertRequest;)
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/ClientCertRequest;)
I/dalvikvm: Could not find method android.webkit.WebViewClient.onReceivedClientCertRequest, referenced from method org.apache.cordova.engine.SystemWebViewClient.onReceivedClientCertRequest
W/dalvikvm: VFY: unable to resolve virtual method 1147: Landroid/webkit/WebViewClient;.onReceivedClientCertRequest (Landroid/webkit/WebView;Landroid/webkit/ClientCertRequest;)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0031
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/PermissionRequest;)
I/dalvikvm: Could not find method android.webkit.PermissionRequest.getResources, referenced from method org.apache.cordova.engine.SystemWebChromeClient.onPermissionRequest
W/dalvikvm: VFY: unable to resolve virtual method 964: Landroid/webkit/PermissionRequest;.getResources ()[Ljava/lang/String;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0023
I/dalvikvm: Could not find method android.webkit.WebChromeClient$FileChooserParams.createIntent, referenced from method org.apache.cordova.engine.SystemWebChromeClient.onShowFileChooser
W/dalvikvm: VFY: unable to resolve virtual method 969: Landroid/webkit/WebChromeClient$FileChooserParams;.createIntent ()Landroid/content/Intent;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0021
D/SystemWebViewEngine: CordovaWebView is running on device made by: unknown
D/PluginManager: init()
D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
D/CordovaActivity: Started the activity.
D/CordovaActivity: Resumed the activity.
D/OpenGLRenderer: Enabling debug mode 0
I/Choreographer: Skipped 81 frames! The application may be doing too much work on its main thread.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
I/chromium: [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/chromium: [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/Choreographer: Skipped 74 frames! The application may be doing too much work on its main thread.
D/SystemWebChromeClient: file:///android_asset/www/cordova_plugins.js: Line 7 : Uncaught SyntaxError: Unexpected string
I/chromium: [INFO:CONSOLE(7)] "Uncaught SyntaxError: Unexpected string", source: file:///android_asset/www/cordova_plugins.js (7)
D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
D/SystemWebChromeClient: file:///android_asset/www/js/index.js: Line 39 : Uncaught ReferenceError: listeningElement is not defined
I/chromium: [INFO:CONSOLE(39)] "Uncaught ReferenceError: listeningElement is not defined", source: file:///android_asset/www/js/index.js (39)
D/SystemWebChromeClient: file:///android_asset/www/index.html: Line 237 : Uncaught TypeError: Cannot call method 'transaction' of undefined
I/chromium: [INFO:CONSOLE(237)] "Uncaught TypeError: Cannot call method 'transaction' of undefined", source: file:///android_asset/www/index.html (237)
What Can I do?
the problem was in this file index.js . I had commented this:
receivedEvent: function(id) { var parentElement =document.getElementById(id);
// var listeningElement = parentElement.querySelector('.listening');
//var receivedElement = parentElement.querySelector('.received');
// listeningElement.setAttribute('style', 'display:none;'); //receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id); }
Then, I had move the tag script with my js/jquery code at the end of the tag

Android: Flurry Banner Ad is not displaying

I have integrated Flurry banner ad on my app. On logcat it says BannerAdObject created, but ad is not displayed. I've attached the code and logcat. I have not found any solution for this issue .
mBanner =(RelativeLayout)view.findViewById(R.id.banner);
mFlurryAdBanner = new FlurryAdBanner(getActivity(), mBanner, mAdSpaceName);
mFlurryAdBanner.setListener(bannerAdListener);
FlurryAdBannerListener bannerAdListener = new FlurryAdBannerListener() {
#Override
public void onFetched(FlurryAdBanner adBanner) {
adBanner.displayAd();
}
//... other Overriden method goes here
};
Logcat
05-02 07:16:47.770 15810-15810/com.test W/FlurryAgent: 'setLogEnabled' method is deprecated.
05-02 07:16:47.770 15810-15810/com.test W/FlurryAgent: 'setLogLevel' method is deprecated.
05-02 07:16:47.810 15810-15810/com.test W/FlurryAgent: 'init' method is deprecated.
05-02 07:16:48.100 15810-15964com.test I/FlurryAgent: New main file also not found. returning..
05-02 07:16:48.105 15810-15964/com.test I/FlurryAgent: New main file also not found. returning..
05-02 07:16:48.115 15810-15964/com.test I/dalvikvm: Could not find method android.os.StatFs.getAvailableBlocksLong, referenced from method com.flurry.sdk.ja.a
05-02 07:16:48.120 15810-15964/com.test I/dalvikvm: Could not find method android.webkit.WebSettings.getDefaultUserAgent, referenced from method com.flurry.sdk.dx$1.a
05-02 07:16:48.125 15810-15964/com.test W/FlurryAgent: Flurry session started for context:com.test.SplashActivity#4273f6d8
05-02 07:16:48.125 15810-15964/com.test W/FlurryAgent: Flurry session resumed for context:com.test.SplashActivity#4273f6d8
05-02 07:16:48.140 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bt; interface 2723 'Lcom/facebook/ads/AdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bt;' failed
05-02 07:16:48.140 15810-15964/com.test E/dalvikvm: Could not find class 'com.flurry.sdk.bt', referenced from method com.flurry.sdk.bu.a
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: VFY: unable to resolve new-instance 3271 (Lcom/flurry/sdk/bt;) in Lcom/flurry/sdk/bu;
05-02 07:16:48.140 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bv; interface 2728 'Lcom/facebook/ads/InterstitialAdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bv;' failed
05-02 07:16:48.140 15810-15964/com.test E/dalvikvm: Could not find class 'com.flurry.sdk.bv', referenced from method com.flurry.sdk.bu.a
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: VFY: unable to resolve new-instance 3273 (Lcom/flurry/sdk/bv;) in Lcom/flurry/sdk/bu;
05-02 07:16:48.140 15810-15964com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bt; interface 2723 'Lcom/facebook/ads/AdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bt;' failed
05-02 07:16:48.140 15810-15964/com.test D/dalvikvm: DexOpt: unable to opt direct call 0x6634 at 0x0c in Lcom/flurry/sdk/bu;.a
05-02 07:16:48.145 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bv; interface 2728 'Lcom/facebook/ads/InterstitialAdListener;'
05-02 07:16:48.145 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bv;' failed
05-02 07:16:48.145 15810-15964/com.test D/dalvikvm: DexOpt: unable to opt direct call 0x664a at 0x0a in Lcom/flurry/sdk/bu;.a
05-02 07:16:48.165 15810-15964/com.test W/webview_proxy: java.lang.Throwable: Warning: A WebView method was called on thread 'FlurryAgent'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
at android.webkit.WebView.checkThread(WebView.java:1895)
05-02 07:40:05.855 12475-12626/com.test D/FlurryAgent: Referrer file contents: null
05-02 07:40:09.090 12475-12626/com.test W/FlurryAgent: Flurry session resumed for context:com.test.HomeActivity#426ec9d8
05-02 07:40:09.445 12475-12661/com.test W/FlurryAgent: Analytics report sent.
05-02 07:40:10.840 12475-12626/com.test W/FlurryAgent: Flurry session paused for context:com.test.SplashActivity#4277efe8
05-02 07:40:14.440 12475-12475/com.test D/FlurryAgent: BannerAdObject created: com.flurry.sdk.q#42bed4d8

GooglePlayServicesUtil.getErrorDialog doesn't work

This has been asked before here and here, but there are not useful answers, so I'll try to be specific: I'm trying to implement Google Cloud Messaging on an app developed using Android Studio 1.2.2. I have installed Google Play Services as explained here, and I implemented the checkPlayServices() method as suggested in this sample:
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
If the device doesn't has Google Play Service or if it is outdated this method should alert the user and provide a button to install/update it easily. I test the app on a Samsung Galaxy S II with Android 4.1.2 with factory settings so it doesn't has an updated Google Play Services. I have confirmed that the GooglePlayServicesUtil.getErrorDialog() method is called, but the dialog doesn't appear. Instead I got the following in the logcat:
06-14 19:19:45.691 10616-10616/? I/dalvikvm﹕ Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
06-14 19:19:45.691 10616-10616/? W/dalvikvm﹕ VFY: unable to resolve virtual method 250: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
06-14 19:19:45.691 10616-10616/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x00c2
06-14 19:19:45.691 10616-10616/? I/dalvikvm﹕ DexOpt: access denied from Lcom/google/android/gms/common/GooglePlayServicesUtil; to field Landroid/app/Notification;.extras
06-14 19:19:45.691 10616-10616/? W/dalvikvm﹕ VFY: unable to resolve instance field 18
06-14 19:19:45.691 10616-10616/? D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x00e1
06-14 19:19:45.691 10616-10616/? E/dalvikvm﹕ Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
06-14 19:19:45.691 10616-10616/? W/dalvikvm﹕ VFY: unable to resolve check-cast 27 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
06-14 19:19:45.691 10616-10616/? D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x000e
06-14 19:19:45.696 10616-10616/? I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh
06-14 19:19:45.696 10616-10616/? W/dalvikvm﹕ VFY: unable to resolve virtual method 542: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
06-14 19:19:45.696 10616-10616/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000b
06-14 19:19:45.696 10616-10616/? W/GooglePlayServicesUtil﹕ Google Play services out of date. Requires 7571000 but found 2012110
I'm completely stuck. Any help will be appreciated.
Your dialog is not being displayed because execution in the UI thread does not suspend when a dialog is created. This means your application will continue to run after the dialog is supposed to be displayed. If your code does something such as:
showDialog();
startDifferentActivity();
A user wouldn't be able to interact with the dialog because the different activity would start before the dialog even displayed. If you have code execution that is dependent on the user selecting the positive/negative/neutral buttons of a dialog or dismissing a dialog, implement the appropriate listeners.

error while trying to receive email using javamail

I tried to receive email from gmail and outlook with IMAP and POP3 in Eclipse (with javamail). But every time I see the same error message.
Receiving using IMAP and Gmail:
Properties props = new Properties();
props.setProperty("mail.store.protocol", "imaps");
props.setProperty("mail.imap.host", "imap.gmail.com");
props.setProperty("mail.imap.port", "993");
props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.imap.socketFactory.fallback", "false");
Session imapSession=Session.getInstance(props);
Store store = imapSession.getStore("imaps");
store.connect("imap.gmail.com","gmail account", "pass");
Folder inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_WRITE);
Message[] msgs =inbox.getMessages();
Message read=msgs[1];
String result=read.toString();
return result;
Error log:
05-15 20:40:58.822: W/dalvikvm(24130): method Lcom/sun/mail/imap/IMAPStore;.getSession incorrectly overrides package-private method with same name in Ljavax/mail/Service;
05-15 20:40:59.772: I/dalvikvm(24130): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:40:59.772: W/dalvikvm(24130): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:40:59.772: W/dalvikvm(24130): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
05-15 20:40:59.772: I/dalvikvm(24130): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:40:59.772: W/dalvikvm(24130): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:40:59.772: I/dalvikvm(24130): Could not find method javax.activation.DataHandler.getName, referenced from method javax.mail.internet.MimeUtility.getEncoding
05-15 20:40:59.772: W/dalvikvm(24130): VFY: unable to resolve virtual method 7893: Ljavax/activation/DataHandler;.getName ()Ljava/lang/String;
05-15 20:40:59.772: D/dalvikvm(24130): VFY: replacing opcode 0x6e at 0x0004
05-15 20:41:02.122: I/dalvikvm(24130): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:41:02.122: W/dalvikvm(24130): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:41:02.122: I/dalvikvm(24130): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:41:02.122: W/dalvikvm(24130): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:41:02.122: E/dalvikvm(24130): Could not find class 'javax.activation.DataHandler', referenced from method com.sun.mail.imap.IMAPMessage.getDataHandler
05-15 20:41:02.122: W/dalvikvm(24130): VFY: unable to resolve new-instance 1177 (Ljavax/activation/DataHandler;) in Lcom/sun/mail/imap/IMAPMessage;
05-15 20:41:02.122: D/dalvikvm(24130): VFY: replacing opcode 0x22 at 0x0032
05-15 20:41:02.122: I/dalvikvm(24130): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:41:02.122: W/dalvikvm(24130): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:41:02.122: W/dalvikvm(24130): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
05-15 20:41:02.192: D/dalvikvm(24130): DexOpt: unable to opt direct call 0x1ec7 at 0x3f in Lcom/sun/mail/imap/IMAPMessage;.getDataHandler
Using POP3 and Outlook:
Properties properties = new Properties();
properties.put("mail.pop3.host", "pop-mail.outlook.com");
properties.put("mail.pop3.port", "995");
properties.put("mail.pop3.starttls.enable", "true");
Session emailSession = Session.getDefaultInstance(properties);
Store store = emailSession.getStore("pop3s");
store.connect("pop-mail.outlook.com", "username", "pass");
Folder emailFolder = store.getFolder("INBOX");
emailFolder.open(Folder.READ_ONLY);
Message[] messages = emailFolder.getMessages();
String result=messages[10].toString();
emailFolder.close(false);
store.close();
return result;
And my error log:
05-15 20:30:46.002: W/dalvikvm(21892): method Lcom/sun/mail/pop3/POP3Store;.getSession incorrectly overrides package-private method with same name in Ljavax/mail/Service;
05-15 20:30:49.312: I/dalvikvm(21892): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:30:49.312: W/dalvikvm(21892): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:30:49.312: W/dalvikvm(21892): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
05-15 20:30:49.312: I/dalvikvm(21892): Failed resolving Ljavax/activation/DataHandler; interface 944 'Ljava/awt/datatransfer/Transferable;'
05-15 20:30:49.312: W/dalvikvm(21892): Link of class 'Ljavax/activation/DataHandler;' failed
05-15 20:30:49.312: I/dalvikvm(21892): Could not find method javax.activation.DataHandler.getContent, referenced from method javax.mail.internet.MimeMessage.getContent
05-15 20:30:49.312: W/dalvikvm(21892): VFY: unable to resolve virtual method 7887: Ljavax/activation/DataHandler;.getContent ()Ljava/lang/Object;
05-15 20:30:49.312: D/dalvikvm(21892): VFY: replacing opcode 0x6e at 0x000b
I can count the number of received mails but no luck with reading them. I am almost new to android but as far as i can see, there's something wrong with the javamail library.
check mail.jar and activation.jar
also check this link:
https://code.google.com/p/javamail-android/downloads/list

Categories

Resources