2

I am trying to use AdMob in my app.

I am using this : https://github.com/appfeel/admob-google-cordova

Following this tutorial : https://github.com/appfeel/admob-google-demo

I have downloaded the zip. Run it on device and got the following error message :

cordova-admob plugin not ready. Are you in desktop browser ? It won't work...

I investigated and found out the plugin isn't even installed. So I tried installing it via the CLI like so :

cordova plugin add cordova-admob

And I get the following messages :

cordova-admob: Warning, could not copy necessary files for angular browser platform.

cordova-admob: Please ensure 'www/lib/angular-admob/angular-admob.js' exists (you can copy it from 'plugins/cordova-admob/angular-admob.js')

I tried copying it from there and created a folder at the location www/lib/angular-admob, as it wasn't there but I get build errors.

Anyone come across this ? I've been at this for weeks, on and off, trying to get the adMob to work for PhoneGap/Cordova but I keep getting different errors. I have tried this plugin :

https://github.com/floatinghotpot/cordova-admob-pro

That one worked great on the android emulator, but not when I, both, served it to my device via the phonegap desktop app and served it from CLI to my device.

Here's the error I am getting now :

ERROR 1

When creating the project from scratch and following these steps :

cordova create AdMobTest || cordova platform add android || cordova plugin add cordova-admob || creating empty lib folder inside my project www folder || cordova plugin remove cordova-admob || cordova plugin add cordova-admob || cordova prepare android || cordova compile android || cordova run android --device –

I'm now getting this error :

ERROR 2

thatOneGuy
  • 9,977
  • 7
  • 48
  • 90

1 Answers1

1

Just create a EMPTY folder with the name lib inside your project www folder:

enter image description here

Clean your project by removing the current version of the plugin with the cordova cli. Remeber to use the cli inside your project root folder:enter image description here

Add the plugin with the cordova cli: enter image description here

Have a nice day!

EDIT : Your error occur inside processDebugResources so it´s nothing about the plugin. To avoid this problem change your target Android SDK to an prior version.

Here is one answered question which adress this problem: Execution failed app:processDebugResources Android Studio

Community
  • 1
  • 1
Martin Godzina
  • 1,470
  • 11
  • 17
  • That installed the plugin :) But I get build errors :( After i added the plugin, i tried running it on device. It gave the error that I have added to my question. Would be super grateful if you could help out again. I have tried adding these png's manually. But when I build the android (cordova build), it overwrites all these. I have looked through what code I can and can't find where these images are set. All it needs is a name change as when I build it adds png's with names started with : 'common_plus' but i need it to be 'common_google'. Thank you – thatOneGuy May 01 '16 at 10:07
  • These are very strange errors. I can build and push one debug.apk onto my android device without any errors. Try this: Open your commandline inside your project root folder, type : "cordova prepare android" after this, "cordova compile android". What output do you get after typing this commends? – Martin Godzina May 01 '16 at 12:36
  • Exactly the same error as before :( Its the names of the png's that it seems to error on :( – thatOneGuy May 02 '16 at 09:23
  • All right. First check if any data inside your platforms\android\build\intermediates\res (or even the res folder) are read only files. In windows just right click on the folder or the file. Uncheck the option if the file is readonly. If this does not solve your problem delete android as a platform from your project and add it again with the CLI: "cordova platform remove android" and "cordova platform add android" – Martin Godzina May 02 '16 at 14:19
  • im still getting errors. Ive unistalled and reinstalled both android and the plugin. Ran it without the plugin and just android. And without android and its still fails. Could you tell me the steps you take to make a bare bones project from the CLI so that i builds on android and has the cordova admob plugin and actually builds please ? – thatOneGuy May 02 '16 at 15:51
  • cordova create AdMobTest || cordova platform add android || cordova plugin add cordova-admob || creating empty lib folder inside my project www folder || cordova plugin remove cordova-admob || cordova plugin add cordova-admob || cordova prepare android || cordova compile android || cordova run android --device – Martin Godzina May 02 '16 at 16:01
  • Updated question, I am now getting a different error :( – thatOneGuy May 03 '16 at 08:06