Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6012] requestAD failure in Alloy

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2018-11-29T23:54:32.000+0000
Affected Version/sAppcelerator Studio 4.3.0
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsn/a
Reporteralejandro_capel
AssigneeShak Hossain
Created2018-11-07T06:22:00.000+0000
Updated2018-11-29T23:54:33.000+0000

Description

Hi, I'm trying use the admod module in android alloy app and I'm taking an issue. (No problem in IOS with same code). This is my error code: ERROR] : TiExceptionHandler: (main) [75,2102] /alloy/controllers/home.js:957 [ERROR] : TiExceptionHandler: $.containerAdmod.requestAd(); [ERROR] : TiExceptionHandler: ^ [ERROR] : TiExceptionHandler: Error: Attempt to invoke virtual method 'void ti.admob.View.requestAd(org.appcelerator.kroll.KrollDict)' on a null object reference I´m not sure what is the problem.Please can you help me? I think is a problem how I'm using this module in alloy but I'm not sure. I have searching in google but i couldn´t find a sample with this implementation. Thanks in advance! Regards.

Attachments

FileDateSize
build_android.log2018-11-13T06:28:05.000+0000873734
error admod.jpg2018-11-14T19:43:47.000+000083066
error alloy in device.rtf2018-11-15T19:38:07.000+000065896
Screenshot_20181115-111548.png2018-11-15T05:29:26.000+000048653
test admod alloy.zip2018-11-14T19:43:31.000+00001639216

Comments

  1. alejandro_capel 2018-11-11

    Please, any sample with admob module using alloy in android? Thanks!!!
  2. Rakhi Mitro 2018-11-12

    Hello, Thanks for your feedback. Are you using studio 4.3.0? Can you try [this](https://github.com/appcelerator-modules/ti.admob/tree/master/android/example) one on android classic ? If it works for you on android, please convert this code to alloy.
  3. alejandro_capel 2018-11-12

    Hi, Yes, Sure. I tested in classic and it was sucesfully. No problem with ios alloy environemt. The Problem is when a call to method requestAd() for recovering the view. If I don´t use this method in code there is no error but obviously app doen´t show the admod view. Please, i have been searching in google but I couldn´t find a sample of using this component with Alloy in Android. Do you have any sample?. It´s a pity in sample component there is not a sample code. Thanks in advance.
  4. Rakhi Mitro 2018-11-13

    Hello, Thanks for your feedback. Can you please share your complete environment details and console logs on a separate text file here? Need to check that.
  5. alejandro_capel 2018-11-13

    [^build_android.log] home.xml : home.tss: "#window": { backgroundColor:"black", extendEdges: Titanium.UI.EXTEND_EDGE_TOP, navBarHidden: true, orientationModes: [Ti.UI.PORTRAIT] } "#window[platform=android]": { exitOnClose: true } "#container": { top: -70, left: 0, width: Ti.UI.FILL, height: Alloy.Globals.TamanoVentana } "#containerAdmod": { top: Alloy.Globals.TopAdmod, left: 0, width: Ti.UI.FILL, height: Alloy.Globals.TamanoAdmod } etc... home.js (important code..): function init() { PutAdmod(0); configureStaticCells(); Clasic(sound); getConfig(); getLists(); // not required when loading local data $.activity_indicator.show(); if (OS_IOS) { $.navbar.back_button.hide(); } if (OS_ANDROID) { $.window.addEventListener('open', function(e){ $.search_textfield.hide(); }); } } init(); //PutAdmod function function PutAdmod( value) { Ti.API.info('start admod ...'); _publisherid = 'ca-app-pub-22222.......'; var Admob = require('ti.admob'); var adView = Admob.createView({ bottom: value, left: 0, width: PosicionarAncho(99), height: PosicionarAlto(10), debugEnabled: false, // If enabled, a dummy value for adUnitId will be used to test adType: Admob.AD_TYPE_BANNER, adUnitId: _publisherid, // You can get your own at http: //www.admob.com/ contentURL: 'http://www.alexcmobile.com', // URL string for a webpage whose content matches the app content. adBackgroundColor: 'transparent', gender: Admob.GENDER_MALE, // GENDER_MALE or GENDER_FEMALE, default: undefined keywords: ['Mythology', 'Gods'] }); adView.addEventListener(Admob.AD_RECEIVED, function() { Ti.API.info('Did receive ad!'); }); adView.addEventListener(Admob.AD_NOT_RECEIVED, function(e) { Ti.API.info('Failed to receive ad: ' + e.error); }); //here the error adMobView.requestAd(); $.containerAdmod.add(adView); }
  6. Rakhi Mitro 2018-11-13

    Thanks for your feedback. We checked your file. Unable to find any error message. Can you please double check?
  7. alejandro_capel 2018-11-13

    Hi again, Yes, the error doesn't write in log file. It´s happens in runtime. I'm not sure this one is due to using Alloy. The error is right here: adMobView.requestAd() . As you can see, Alloy's view has not yet been opened, which is just the next line in the code -> $.containerAdmod.add(adView); What is the meaning of this error? [ERROR] : TiExceptionHandler: Error: Attempt to invoke virtual method 'void ti.admob.View.requestAd(org.appcelerator.kroll.KrollDict)' on a null object reference . its seems the poblem comes with View, rigth? Thanks.
  8. Rakhi Mitro 2018-11-14

    Hello, Thanks for your feedback. Please share your full test project here to reproduce the issue on our end.
  9. alejandro_capel 2018-11-14

    OK. I send u a custom project with alloy functionality. In another file , the error in emulator. Please let me know any question. Thanks in advance.
  10. Rakhi Mitro 2018-11-15

    [~alexcc], Thanks for your feedback. Tested your issue and its works as expected on android device. See attachment section for output. Download the sample test project from [here](https://www.dropbox.com/s/bhpkvt4vi8gvu58/testAlloy.zip?dl=0),run on your environment and let us know how it goes.
  11. alejandro_capel 2018-11-15

    Hi Rakhi, I have loaded your program in device and I have the error however now I have a very large trace. [^error alloy in device.rtf] Its seems the reason is : [INFO] : zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.TracingController" on path: DexPathList[[zip file "/data/app/com.android.chrome-PijQzE41jAPf1Jo6KRDwGg==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-PijQzE41jAPf1Jo6KRDwGg==/lib/arm64, /data/app/com.android.chrome-PijQzE41jAPf1Jo6KRDwGg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] [INFO Can you have a look ,please? thanks
  12. Sharif AbuDarda 2018-11-16

    Hello, Can you share the "appc ti setup check" log in here? Thanks.

JSON Source