KivMob
KivMob copied to clipboard
Cannot call instance method 'addContentView' on class 'org/kivy/android/PythonActivity'
Hi, I try to integrate my Kivy app with AdMob using KivMob, however so far I'm not able even to successfully run demo app. Application runs, but no ads are shown and following error is thrown in logcat:
python : [INFO ] [GL ] NPOT texture support is available
python : [INFO ] [KivMob ] __init__ called.
python : [INFO ] [KivMob ] Android platform detected.
python : [INFO ] [KivMob ] new_banner() called.
python : [INFO ] [KivMob ] new_interstitial() called.
python : [INFO ] [KivMob ] request_banner() called.
python : [INFO ] [KivMob ] request_interstitial() called.
python : [INFO ] [KivMob ] set_rewarded_ad_listener() called.
python : [INFO ] [KivMob ] load_rewarded_ad() called.
python : [WARNING] [Base ] Unknown <android> provider
python : [INFO ] [Base ] Start application main loop
python : Traceback (most recent call last):
python : File "/home/zuku/projects/KivMob/demo/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/kivmob/armeabi-v7a/android/runnable.py", line 38, in run
python : File "/home/zuku/projects/KivMob/demo/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/kivmob/armeabi-v7a/kivmob.py", line 217, in new_banner
python : File "jnius/jnius_export_class.pxi", line 844, in jnius.jnius.JavaMethod.__call__
python : jnius.jnius.JavaException: Cannot call instance method b'addContentView' on class b'org/kivy/android/PythonActivity'
python : [INFO ] [KivMob ] onRewardedVideoAdLoaded() called.
There's one thing I had to change in buildozer.spec - I updated android.ndk version to 23. For 19b buildozer immediately crashes with error:
[ERROR]: Build failed: The minimum supported NDK version is 23. You can download it from https://developer.android.com/ndk/downloads/.
Can this be the reason?
I also have the same problem.
Same error happened to me.. Any solution?
: [INFO ] [KivMob ] init called. : [INFO ] [KivMob ] Android platform detected. : [INFO ] [KivMob ] new_banner() called. : [INFO ] [KivMob ] request_banner() called. : Traceback (most recent call last): : File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/testsapp22/arm64-v8a/android/runnable.py", line 38, in run : File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/testsapp22/arm64-v8a/kivmob.py", line 217, in new_banner : File "jnius/jnius_export_class.pxi", line 844, in jnius.jnius.JavaMethod.call : jnius.jnius.JavaException: Cannot call instance method b'addContentView' on class b'org/kivy/android/PythonActivity'
Will try to find some time to look into this, it may be that these methods have changed or are no longer supported.
Any solution found?
Not at the moment, haven't been able to make time for this project as of recently. Will try to make time this weekend.
Through trial and error I was able to make KivMob working in my app. Basically all I had to do was change line 261 (new_banner
method) from:
activity.addContentView(layout, layoutParams)
to
activity.mActivity.addContentView(layout, layoutParams)
According to the docs mActivity is the instance of the current Activity, however I'm not familiar with Pyjnius at all so I cannot tell if anything was changed there recently.
Problem seems to be related only to the banner, other ads work for me without any modifications.
Greetings, I am experiencing the same Issue on Kivmob 2.0. Unfortunately, changing 'activity.addContentView(layout, layoutParams)' (that in this kivmob.py it is on line 217) doesn't solve anything. Maybe someone could share some suggestion, please?
According to this the commands work. The problem I was talking about could depend upon having an Admob account linked to the app.
May someone please confirm it?
If someone is interested I have created an Admod account, and now the error messages disappeared. Unfortunately the banners still don't work, but at this point I don't know if this depend on the application itself or on the admod account (which settings seems incredibly difficult to me)