Running the above (for different plugins) in Android Studio (Emulator and device) I've got this (summary):
My folder structure looks like,
|--app: |--|--src: |--|--|--main |--|--|--|--jniLibs |--|--|--|--|--armeabi |--|--|--|--|--|--libads.so|--|--|--|--|--|--libbitop.so|--|--|--|--|--|--libfacebook.so|--|--|--|--|--|--libflurry.so|--|--|--|--|--|--libgaming.so|--|--|--|--|--|--libgideros.so|--|--|--|--|--|--libgooglelicensing.so|--|--|--|--|--|--libgoogleplay.so|--|--|--|--|--|--libgvfs.so|--|--|--|--|--|--libjson.so|--|--|--|--|--|--liblfs.so|--|--|--|--|--|--liblsqlite3.so|--|--|--|--|--|--liblua.so|--|--|--|--|--|--libluasocket.so|--|--|--|--|--armeabi-v7a |--|--|--|--|--|--libads.so|--|--|--|--|--|--libbitop.so|--|--|--|--|--|--libfacebook.so|--|--|--|--|--|--libflurry.so|--|--|--|--|--|--libgaming.so|--|--|--|--|--|--libgideros.so|--|--|--|--|--|--libgooglelicensing.so|--|--|--|--|--|--libgoogleplay.so|--|--|--|--|--|--libgvfs.so|--|--|--|--|--|--libjson.so|--|--|--|--|--|--liblfs.so|--|--|--|--|--|--liblsqlite3.so|--|--|--|--|--|--liblua.so|--|--|--|--|--|--libluasocket.so|--|--|--|--|--x86 |--|--|--|--|--|--libads.so|--|--|--|--|--|--libbitop.so|--|--|--|--|--|--libfacebook.so|--|--|--|--|--|--libflurry.so|--|--|--|--|--|--libgaming.so|--|--|--|--|--|--libgideros.so|--|--|--|--|--|--libgooglelicensing.so|--|--|--|--|--|--libgoogleplay.so|--|--|--|--|--|--libgvfs.so|--|--|--|--|--|--libjson.so|--|--|--|--|--|--liblfs.so|--|--|--|--|--|--liblsqlite3.so|--|--|--|--|--|--liblua.so|--|--|--|--|--|--libluasocket.soand so on
So ads plugin and gaming plugin crash because are true (isPluginAvailable) but modules are "nil"
P.D. my application running (Android Emulator and device) if I block ads plugin and gaming plugin
I forgotten gideros doesn't construct apk file neither install it on my android device. Also when I export full project (I did verify and configurated in all plugins that I needed in gideros console) for android studio (no old version) myAppActivy.java, manifest.xml, string and app gradle aren't configurated default in android studio so I did it manually.
Ads and Gaming plugins have multiple backends, hence you have to create the correct instance yourself: ads=Ads.new("backend")
@hygy29 It's correct but the issue is in "Ads" is "nil" also "Gaming" is "nil" though .
local isAdsAvailable =pcall(function()require'ads'end)local isGamingAvailable =pcall(function()require'gaming'end)print(isAdsAvailable,isGamingAvailable )-- you get true and true respectively (Android Studio)
This a big problem because app always goes to crash because in Android Studio or Emulator .
if isAdsAvailable thenrequire'ads'end-- isAdsAvailable is trueif isGamingAvailable thenrequire'gaming'end-- isGamingAvailable is true--[[
you get the next:
Ads equal to "nil"
Gaming equal to "ni"
]]
Hence the system said to you hey!! libgaming.so and libads.so are "available" but both -Ads and Gaming- are "nil"
Ah! also "error" (when you use pcall) is "nil" in facebook, flurry, Ads, googlelicensing and Gaming- I suppose that mean there isn't error or maybe I'm losing something, I don't know
Yes, that would mean there is no error actually. Maybe I was mislead because in the code you posted you were printing 'gaming', while you should have printed 'Gaming'. Can you double check ?
System.loadLibrary("gaming")--It's in proyect --in Gideros Code I use global var. Gaming
System.loadLibrary("ads")--It's in proyect --in Gideros Code I use global var. Ads
System.loadLibrary("facebook")--It's in proyect
System.loadLibrary("flurry")--It's in proyect
System.loadLibrary("googlelicensing")--It's in proyect
System.loadLibrary("googleplay")--It's in proyect
For that reason "pcall" does not catch any error in Android Studio So I checked files android.mk for review its paths and so I moved gideros studio to:
Well, with these new winds my problem inicial persistent for example:
facebook: attempt to call method 'setAppId'(a nil value)-- no error with "pcall" and facebook is true
Gaming: attempt to index field 'gaming'(a nil value)-- no error with "pcall" and Gaming is true
flurry: index '__userdata' cannot be found -- no error with "pcall" and Gaming is true
So i don't know what be able to happen, well 'Ads', 'googlelicensing' and 'googleplay' don't crash, Although, I suppose this is because they should be tested in alpha or beta version in "google play console"
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Here is an example of pcall calling a function that has a reply, but you need to know if the call to the function failed and if it didn't then you need to know the reply from the function:
local result,reply=pcall(Shader.new,shaderV,bloomF,Shader.FLAG_FROM_CODE,{{name="vMatrix",type=Shader.CMATRIX,sys=Shader.SYS_WVP,vertex=true},
{name="fColor",type=Shader.CFLOAT4,sys=Shader.SYS_COLOR,vertex=false},
{name="fTexture",type=Shader.CTEXTURE,vertex=false}, },
{{name="vVertex",type=Shader.DFLOAT,mult=3,slot=0,offset=0},
{name="vColor",type=Shader.DUBYTE,mult=4,slot=1,offset=0},
{name="vTexCoord",type=Shader.DFLOAT,mult=2,slot=2,offset=0}, })if result then
bloomShader=reply
elseprint("bloom shader error:",reply)end
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@HubertRonald re that error, look at the line just after/before 279.
can you post a code snip, indicating the line number for each line.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Here is another pcall example to check if the new firebase plugin has been installedL
pcall(function()require"firebase"end)if firebase thenprint("firebase ok")elseprint("firebase not installed")end
Here is a check for flurry, I use a global called flurryId that I set at the start of my code with the ID that flurry give me for my game (the id is different per platform so I use the application:getDeviceInfo to check for the device and set the appropriate flurryId) :
if flurryId thenpcall(function()require"flurry"end)if flurry ~=niland flurry.isAvailable()then
flurry.startSession(flurryId)endend
Here is a message routine to send to either/both of them that checks to see if they have been setup:
function message(mess,param)if firebase thenif param==nilthen
firebase:analyticsEvent(mess)else
firebase:analyticsEvent(mess,param)endendif flurry and flurry.isAvailable()thenif param==nilthen
flurry.logEvent(mess)else
flurry.logEvent(mess,param)endendend
.
.
.
message("Game launched")
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@HubertRonald re that error, look at the line just after/before 279.
can you post a code snip, indicating the line number for each line.
ok
line 84: local Achievements = Core.class(EventDispatcher)
:
:
line 87: function Achievements:init(player)
line 88:
line 89: self:deployGaming()
:
:
line 271: pcall(function()require"gaming"end)
line 272: function Achievements:deployGaming()
line 273: --ini conditions
line 274: if Gaming then
line 275:
line 276: self.gaming.isLoaded =false
line 277:
line 278: --print("googleplay GameServices")
line 279: self.gameServices = Gaming.new("googleplay")--<<--- Here's where code crash
line 280:
:
:
line 362: return Achievements
Not only Gaming, but also other plugins... my problem inicial persistent
facebook: attempt to call method 'setAppId'(a nil value)-- no error with "pcall" and facebook is true
Gaming: attempt to index field 'gaming'(a nil value)-- no error with "pcall" and Gaming is true
flurry: index '__userdata' cannot be found -- no error with "pcall" and Gaming is true
So i don't know what be able to happen, well 'Ads', 'googlelicensing' and 'googleplay' don't crash, Although, I suppose this is because they should be tested in alpha or beta version in "google play console"
com.giderosmobile.android.player.LuaException: SocialMedia/Achievements.lua:279: attempt to index field 'gaming'(a nil value)
doesn't match your code, since there is no attempt to index 'gaming' here:
line 279: self.gameServices = Gaming.new("googleplay")--<<--- Here's where code crash
Are you sure the error you got wasn't from a previous version of your source code ?
Hi @hgy29 Yes! I modified the code with some suggestion of @SinisterSoft... so some line up and other down but the crash happened always in this line in the case Gaming with facebook and flurry too in its same line.
so "attempt to index field 'gaming' (a nil value)" maybe i'm trying to index a nil value, but in previous report you can see (Running-> print(Gaming): table: 0x936911ac) that is all there
Maybe there's something worth with my process from Gideros to Android Studio I'm new to this too.
Errors is not isolated with Gaming this also applies to facebook and flurry.
Well, I don't know for flurry and Gaming (but I think @SinisterSoft can confirm it does work ok), but I use Facebook in my own app on both Android and iOS, with automatic plugin export, and everything works fine.
Oh, I just checked, there is no setAppId() function in facebook plugin!!!
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
You need to create a table before you start using it in Lua, Lua isn't really object oriented and having a var.whatever is really just an entry in a table pointed to by var called whatever. So create the table and your problem should be gone.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@HubertRonald - so what was the solution? Had you missed out defining the table?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
Likes: pie
Likes: antix
Edit: I'm using Gideros 2017.3.1
my init.lua has the next:
My folder structure looks like,
any suggestion @john, @hgy29 or sombody
Thanks
P.D. my application running (Android Emulator and device) if I block ads plugin and gaming plugin
I forgotten gideros doesn't construct apk file neither install it on my android device. Also when I export full project (I did verify and configurated in all plugins that I needed in gideros console) for android studio (no old version) myAppActivy.java, manifest.xml, string and app gradle aren't configurated default in android studio so I did it manually.
[-] Liasoft
Ads and Gaming plugins have multiple backends, hence you have to create the correct instance yourself: ads=Ads.new("backend")
.
.
[-] Liasoft
[-] Liasoft
But in Android Studio Build / Analyze Apk I see
So I checked files android.mk for review its paths and so I moved gideros studio to:
Add C and C++ Code to Your Project --though it is not strictly necessary
Well, with these new winds my problem inicial persistent
for example:
Any new ideas are welcome
[-] Liasoft
As plugins.so are tables, I used this script (thx @ar2rsawseen) in Gaming (global variable)
Running-> print(Gaming): table: 0x936911ac
Running-> printR(Gaming): I've got this:
maybe i'm trying to index a nil value, but in previous report you can see that is all there
Again... Any new ideas are welcome
[-] Liasoft
Likes: HubertRonald
https://deluxepixel.com
Likes: HubertRonald
https://deluxepixel.com
Likes: HubertRonald
https://deluxepixel.com
Some strange has happened... I saw the report crash in Android Studio
I'm really baffled because I don't get out of this mistake
Any suggestion thanks
Pd. Only I want to Clarify something, I've tested with and without upgrade gradle
[-] Liasoft
Likes: HubertRonald
https://deluxepixel.com
can you post a code snip, indicating the line number for each line.
https://deluxepixel.com
Likes: HubertRonald
https://deluxepixel.com
I have tried as you indicate in your codes (I like them), but still the crashes in Android Studio are maintained.
Maybe there's something worth with my process from Gideros to Android Studio I'm new to this too.
I'll keep trying if I find the fault.
[-] Liasoft
[-] Liasoft
It's a Class Achievements.. it's like when create local math function (This is outside the class functions but it's available for each one of them)
Not only Gaming, but also other plugins... my problem inicial persistent
So i don't know what be able to happen, well 'Ads', 'googlelicensing' and 'googleplay' don't crash, Although, I suppose this is because they should be tested in alpha or beta version in "google play console"
[-] Liasoft
Yes! I modified the code with some suggestion of @SinisterSoft... so some line up and other down but the crash happened always in this line in the case Gaming
with facebook and flurry too in its same line.
so "attempt to index field 'gaming' (a nil value)"
maybe i'm trying to index a nil value, but in previous report you can see (Running-> print(Gaming): table: 0x936911ac) that is all there
Maybe there's something worth with my process from Gideros to Android Studio I'm new to this too.
Errors is not isolated with Gaming this also applies to facebook and flurry.
[-] Liasoft
Oh, I just checked, there is no setAppId() function in facebook plugin!!!
Likes: SinisterSoft, HubertRonald
Likes: HubertRonald
https://deluxepixel.com
The error was: The error is that I didn't put
Likes: HubertRonald
https://deluxepixel.com
Likes: HubertRonald
https://deluxepixel.com
Likes: SinisterSoft, hgy29
[-] Liasoft
@hgy29... How can I buy your "firebase" plugin?
Cheers
[-] Liasoft
https://deluxepixel.com
Edit: still this method -setAppId()- is here for iOS though it's deprecated.
and flurry well I think use "firebase" plugin but first I wanted to be secure If I might export to android correctly
Likes: SinisterSoft
[-] Liasoft