Hi!
@ar2rsawseen can you help me please?
I have done the following steps:
- Copy libs folder into your exported project (only armeabi, armeabi-v7a and SamsungAdHub_AndroidSDK_V2.5.4_global.jar )
-Copy src folder into your exported project(only Ads.java, AdsInterface.java and AdsSamsung.java)
-Copy res folder into your exported project
-Add System.loadLibrary("ads"); to your main activity
-Add "com.giderosmobile.android.plugins.ads.Ads" as external class in your main activity
-Import import com.yourdomain.yourapp.R; in your main activity
-Comment out //setContentView(mGLView);
-And add this code instead:
setContentView(R.layout.main);
//get main layout
final FrameLayout layout = (FrameLayout)findViewById(R.id.layout_main);
// Add the Gideros view to main layout
layout.addView(mGLView);
In main.lua
require "ads"
In level01.lua:
ads = Ads.new("samsung")
--local test
ads:setKey("number of samsung.lua")
ads:showAd("banner")
ads:addEventListener(Event.AD_RECEIVED, function()
print("ads AD_RECEIVED")
end)
ads:addEventListener(Event.AD_FAILED, function(e)
print("ads AD_FAILED", e.error)
end)
ads:addEventListener(Event.AD_ACTION_BEGIN, function()
print("ads AD_ACTION_BEGIN")
end)
ads:addEventListener(Event.AD_ACTION_END, function()
print("ads AD_ACTION_END")
end)
ads:addEventListener(Event.AD_DISMISSED, function()
print("ads AD_DISMISSED")
end)
ads:addEventListener(Event.AD_ERROR, function(e)
print("ads AD_ERROR", e.error)
end)
.....
function level01:onTransitionOutEnd()
ads:hideAd("banner")
end
Get the following error in Eclipse:
11-08 14:25:29.553: I/System.out(21773): [socket][0] connection ad.samsungadhub.com/54.241.151.195:80(7000)
11-08 14:25:29.840: I/System.out(21773): [socket][/192.168.1.34:58934]
11-08 14:25:30.300: D/SamsungAdHub(21773): ad failed: conntection failed
11-08 14:25:45.302: D/SamsungAdHub(21773): ad request
11-08 14:25:45.761: D/SamsungAdHub(21773): ad failed: conntection failed
11-08 14:26:00.767: D/SamsungAdHub(21773): ad request
11-08 14:26:01.432: D/SamsungAdHub(21773): ad failed: conntection failed
11-08 14:26:05.130: D/AndroidRuntime(21773): Shutting down VM
11-08 14:26:05.130: W/dalvikvm(21773): threadid=1: thread exiting with uncaught exception (group=0x40020648)
11-08 14:26:05.149: E/AndroidRuntime(21773): FATAL EXCEPTION: main
11-08 14:26:05.149: E/AndroidRuntime(21773): java.lang.NullPointerException
11-08 14:26:05.149: E/AndroidRuntime(21773): at com.giderosmobile.android.plugins.ads.Ads$8.run(Ads.java:320)
11-08 14:26:05.149: E/AndroidRuntime(21773): at android.os.Handler.handleCallback(Handler.java:618)
11-08 14:26:05.149: E/AndroidRuntime(21773): at android.os.Handler.dispatchMessage(Handler.java:123)
11-08 14:26:05.149: E/AndroidRuntime(21773): at android.os.Looper.loop(SourceFile:351)
11-08 14:26:05.149: E/AndroidRuntime(21773): at android.app.ActivityThread.main(ActivityThread.java:3850)
11-08 14:26:05.149: E/AndroidRuntime(21773): at java.lang.reflect.Method.invokeNative(Native Method)
11-08 14:26:05.149: E/AndroidRuntime(21773): at java.lang.reflect.Method.invoke(Method.java:538)
11-08 14:26:05.149: E/AndroidRuntime(21773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
11-08 14:26:05.149: E/AndroidRuntime(21773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
11-08 14:26:05.149: E/AndroidRuntime(21773): at dalvik.system.NativeStart.main(Native Method)
11-08 14:26:07.599: I/Process(21773): Sending signal. PID: 21773 SIG: 9
Thanks for the help!
Comments
does it happen only with Samsung or with any framework?
From the error it seems that
ads:hideAd("banner")
is being called after the internal Ad object has been destroyed (or has not been created yet) but it really does not make sense as in this state should not happen
You can also send me the Lua project and I can try it out. If you want, send it to ar2rsawseen at gmail.com
I've only tested with Samsung. Send you to your email now.
Thanks