Help in creating banner with Martin Felis android port

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
phfranqueira
Prole
Posts: 6
Joined: Thu Mar 30, 2017 6:02 pm

Help in creating banner with Martin Felis android port

Post by phfranqueira » Thu Mar 30, 2017 6:47 pm

I am a beginner in LÖVE development, English is not my first language and this is my first post in this forum... so HELLO! :awesome:

Well, I was designated with the task of implementing an AdMob banner ad in a game made with LÖVE, already ported to Android using the Martin Felis port, but the older version:

https://bitbucket.org/MartinFelis/love- ... 2/overview

I tried a lot of things, without success. Then I stumbled with a more recent forum topic, where Martin (master both) says that adding google play services library is not needed anymore. To show ads, is just necessary to call the functions he created, like "love.system.showBanner()". In this topic, he links to a new bitbucket url with, I think, a more recent version of the port:

https://bitbucket.org/npinochet/love-an ... 2/overview

Well... I tried a number of things to make this banner appear:
>I tried adding google play lib in the older port, the one that already had the game that i need to implement the banner with;
>I tried porting the game to the nem port, the one in the npinochet repository, that doesn't need the google play library, but the game couldn't generate a build
>At last, i tried adding the library in this new port that doesn't require it, and it finally generated a build. BUT

The main error that i keep getting, the dead-end in all these alternatives I tried, is that the game doesn't recognize the new functions Martin created, createBanner() and showBanner().

The message error I get is the following:

Image

In these last days I already learned about Ant apache, NDK, adding libraries without gradle or IDE and using adb debugger to track errors. But now i hit this dead end, and I don't know what to try anymore.

Any help? (I tried to PM Martin, but I couldn't)

User avatar
master both
Party member
Posts: 256
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Help in creating banner with Martin Felis android port

Post by master both » Fri Mar 31, 2017 2:41 am

Hi! I'm the creator of the AdMob port. First to be clear, I'm not Martin Felis, I just forked (cloned) his repository and added the AdMob functions on top of it. It looks like you're having problems building your game with my repository, which is odd, cause it's the same process as martin's repository. You can PM me with your errors and I will try to help you :)

User avatar
yetneverdone
Party member
Posts: 351
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Help in creating banner with Martin Felis android port

Post by yetneverdone » Fri Mar 31, 2017 7:03 am

master both wrote:
Fri Mar 31, 2017 2:41 am
Hi! I'm the creator of the AdMob port. First to be clear, I'm not Martin Felis, I just forked (cloned) his repository and added the AdMob functions on top of it. It looks like you're having problems building your game with my repository, which is odd, cause it's the same process as martin's repository. You can PM me with your errors and I will try to help you :)


Say, wouldnt it be more helpful if you would also help OP in this thread? So future askers would refer to this thread.
I also would like to implement admob since im currently porting my game to android. So a clear and updated instruction would be helpful.

User avatar
master both
Party member
Posts: 256
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Help in creating banner with Martin Felis android port

Post by master both » Fri Mar 31, 2017 3:56 pm

yetneverdone wrote:
Fri Mar 31, 2017 7:03 am
master both wrote:
Fri Mar 31, 2017 2:41 am
Hi! I'm the creator of the AdMob port. First to be clear, I'm not Martin Felis, I just forked (cloned) his repository and added the AdMob functions on top of it. It looks like you're having problems building your game with my repository, which is odd, cause it's the same process as martin's repository. You can PM me with your errors and I will try to help you :)


Say, wouldnt it be more helpful if you would also help OP in this thread? So future askers would refer to this thread.
I also would like to implement admob since im currently porting my game to android. So a clear and updated instruction would be helpful.
Sure I can do that :)

phfranqueira
Prole
Posts: 6
Joined: Thu Mar 30, 2017 6:02 pm

Re: Help in creating banner with Martin Felis android port

Post by phfranqueira » Fri Mar 31, 2017 4:18 pm

Oh, sorry for the misunderstanding!

Well, the person who passed me this task already had ported the game with the Martin Felis repository. I made my own builds with his and yours repository, and tested in a Android device and it runned normally.

It's these new love.system functions that I can't use for the life of me.

When you say that adding the google play library is not anymore necessary, the changes to the GameActivity still need to be made? Because with these changes, the project can only be build sucessfully after including "google.gms.ad.* " (or something like this) in the beggining of the class.

Could you tell me some steps so that your new functions can be acessed by my code? I think this is the main problem...

User avatar
yetneverdone
Party member
Posts: 351
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Help in creating banner with Martin Felis android port

Post by yetneverdone » Fri Mar 31, 2017 5:59 pm

master both wrote:
Fri Mar 31, 2017 3:56 pm
yetneverdone wrote:
Fri Mar 31, 2017 7:03 am
master both wrote:
Fri Mar 31, 2017 2:41 am
Hi! I'm the creator of the AdMob port. First to be clear, I'm not Martin Felis, I just forked (cloned) his repository and added the AdMob functions on top of it. It looks like you're having problems building your game with my repository, which is odd, cause it's the same process as martin's repository. You can PM me with your errors and I will try to help you :)


Say, wouldnt it be more helpful if you would also help OP in this thread? So future askers would refer to this thread.
I also would like to implement admob since im currently porting my game to android. So a clear and updated instruction would be helpful.
Sure I can do that :)
Awesome then.

User avatar
master both
Party member
Posts: 256
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Help in creating banner with Martin Felis android port

Post by master both » Sat Apr 01, 2017 4:25 am

phfranqueira wrote:
Fri Mar 31, 2017 4:18 pm
Oh, sorry for the misunderstanding!

Well, the person who passed me this task already had ported the game with the Martin Felis repository. I made my own builds with his and yours repository, and tested in a Android device and it runned normally.

It's these new love.system functions that I can't use for the life of me.

When you say that adding the google play library is not anymore necessary, the changes to the GameActivity still need to be made? Because with these changes, the project can only be build sucessfully after including "google.gms.ad.* " (or something like this) in the beggining of the class.

Could you tell me some steps so that your new functions can be acessed by my code? I think this is the main problem...
Ok so first, there's no need to modify GameActivity and there's also no need to add the google play library since it's already on the lib path on my repo, you just have to follow the instruccions on the wiki on how to build the apk, so basically just follow the steps from here: [Windows, macOS, Linux] which can be resumed in 1) install dependencies 2) clone repo 3) run ndk-build 4) run ant. After all of that is working you can follow this instruccions [link] to package you game with the apk.

If you have any problem with those steps, let me know :)

Also I remember to check the OS for android before calling the love.system.*ads/google functions to avoid errors when running the game on desktop:

Code: Select all

function love.load()
	if love.system.getOS() == "Android" then
		love.system.createBanner("ca-app-pub-9796530573307706/1938301675", "bottom", "SMART_BANNER")
		love.system.showBanner()
	end
end

phfranqueira
Prole
Posts: 6
Joined: Thu Mar 30, 2017 6:02 pm

Re: Help in creating banner with Martin Felis android port

Post by phfranqueira » Mon Apr 03, 2017 7:55 pm

Ok so first, there's no need to modify GameActivity and there's also no need to add the google play library since it's already on the lib path on my repo, you just have to follow the instructions on the wiki on how to build the apk, so basically just follow the steps from here: [Windows, macOS, Linux] which can be resumed in 1) install dependencies 2) clone repo 3) run ndk-build 4) run ant. After all of that is working you can follow this instructions [link] to package you game with the apk.

If you have any problem with those steps, let me know :)

Also I remember to check the OS for android before calling the love.system.*ads/google functions to avoid errors when running the game on desktop:
Ok, I restarted all the process.
Made damn sure that all dependencies where correctly installed and accessible by the system.
Java - 1.8.0_121
Cordova - 6.5.0
Ant - 1.10.1
NDK - (downgraded to r9d)
SDK - (downgraded to 4.4.2, but didn't delete the newer ones)
SDK Build-Tools Rev 19.1 (again, didn't deleted the newer ones)


Downloaded the repo (the Martin Felis one, I suppose it's to ignore the npinochet one?) in .zip, the 0.10.2 version.

Made the ndk-build, then made the ant debug deploy.
Put my game.love in the assets folder, put own ad in the configurations and made a check for the OS and deployed the game again.

I got the same error reported in my first post: attempt to call method 'createBanner' (a nil value).

(Oh, and building is not the problem, without these functions the game works normally)

Any suggestions?

User avatar
master both
Party member
Posts: 256
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Help in creating banner with Martin Felis android port

Post by master both » Tue Apr 04, 2017 2:25 am

phfranqueira wrote:
Mon Apr 03, 2017 7:55 pm
Ok so first, there's no need to modify GameActivity and there's also no need to add the google play library since it's already on the lib path on my repo, you just have to follow the instructions on the wiki on how to build the apk, so basically just follow the steps from here: [Windows, macOS, Linux] which can be resumed in 1) install dependencies 2) clone repo 3) run ndk-build 4) run ant. After all of that is working you can follow this instructions [link] to package you game with the apk.

If you have any problem with those steps, let me know :)

Also I remember to check the OS for android before calling the love.system.*ads/google functions to avoid errors when running the game on desktop:
Ok, I restarted all the process.
Made damn sure that all dependencies where correctly installed and accessible by the system.
Java - 1.8.0_121
Cordova - 6.5.0
Ant - 1.10.1
NDK - (downgraded to r9d)
SDK - (downgraded to 4.4.2, but didn't delete the newer ones)
SDK Build-Tools Rev 19.1 (again, didn't deleted the newer ones)


Downloaded the repo (the Martin Felis one, I suppose it's to ignore the npinochet one?) in .zip, the 0.10.2 version.

Made the ndk-build, then made the ant debug deploy.
Put my game.love in the assets folder, put own ad in the configurations and made a check for the OS and deployed the game again.

I got the same error reported in my first post: attempt to call method 'createBanner' (a nil value).

(Oh, and building is not the problem, without these functions the game works normally)

Any suggestions?
Ok, so the problem is that you're using the normal/vanilla version of LÖVE by using Martin's repo, you have to use mine (npinochet's) to use the AdMobs functions. So just rebuild your game with npinochet's repo and it should work.

User avatar
yetneverdone
Party member
Posts: 351
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Help in creating banner with Martin Felis android port

Post by yetneverdone » Tue Apr 04, 2017 6:52 am

phfranqueira wrote:
Mon Apr 03, 2017 7:55 pm
Ok so first, there's no need to modify GameActivity and there's also no need to add the google play library since it's already on the lib path on my repo, you just have to follow the instructions on the wiki on how to build the apk, so basically just follow the steps from here: [Windows, macOS, Linux] which can be resumed in 1) install dependencies 2) clone repo 3) run ndk-build 4) run ant. After all of that is working you can follow this instructions [link] to package you game with the apk.

If you have any problem with those steps, let me know :)

Also I remember to check the OS for android before calling the love.system.*ads/google functions to avoid errors when running the game on desktop:
Ok, I restarted all the process.
Made damn sure that all dependencies where correctly installed and accessible by the system.
Java - 1.8.0_121
Cordova - 6.5.0
Ant - 1.10.1
NDK - (downgraded to r9d)
SDK - (downgraded to 4.4.2, but didn't delete the newer ones)
SDK Build-Tools Rev 19.1 (again, didn't deleted the newer ones)


Downloaded the repo (the Martin Felis one, I suppose it's to ignore the npinochet one?) in .zip, the 0.10.2 version.

Made the ndk-build, then made the ant debug deploy.
Put my game.love in the assets folder, put own ad in the configurations and made a check for the OS and deployed the game again.

I got the same error reported in my first post: attempt to call method 'createBanner' (a nil value).

(Oh, and building is not the problem, without these functions the game works normally)

Any suggestions?

Mine works fine. No need to downgrade ndk, you can use the latest version. Yes, you need to use the other repo, not the martin.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests