I've a weird error using a simple notification testing app using android.
The error:
python : AttributeError: type object 'notification.org.notificator.R$drawable' has no attribute 'icon'
The python file:
import kivy
from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivy.lang import Builder
from plyer import notification
from kivy.uix.screenmanager import ScreenManager
class NotificationScreen(MDScreen):
def do_notify(self, mode='fancy'):
title = self.ids.notification_title.text
message = self.ids.notification_text.text
ticker = self.ids.ticker_text.text
app_ico = 'Images/icon.png'
notification.notify(app_icon=app_ico, title=title, message=message, ticker=ticker, timeout=10)
#notification.notify(app_icon='Images/icon.ico', title=title, message=message, ticker=ticker, timeout=10)
#notification.notify(title=title, message=message, ticker=ticker, timeout=10)
class ScreenManagement(ScreenManager):
pass
view = Builder.load_file('main.kv')
class NotificationDemoApp(MDApp):
def build(self):
return view
if __name__ == '__main__':
NotificationDemoApp().run()
The KV file:
ScreenManagement:
id: scrm
NotificationScreen:
scrm: scrm
<NotificationScreen>:
notification_title: notification_title
notification_text: notification_text
ticker_text: ticker_text
MDBoxLayout:
orientation: 'vertical'
md_bg_color: 0, 0, 0, 1
MDBoxLayout:
orientation: 'horizontal'
size_hint: 1, None
md_bg_color: 1, 1, 1, 1
TextInput:
id: notification_title
text: 'Put title here'
size_hint: 1, None
TextInput:
id: notification_text
text: 'Put message here'
size_hint: 1, None
TextInput:
id: ticker_text
text: 'New notification'
size_hint: 1, None
Button:
text: 'Toast Notification'
size_hint: 1, None
on_release: root.do_notify(mode='toast')
Button:
text: 'Simple Notification'
size_hint: 1, None
on_release: root.do_notify(mode='normal')
Button:
text: 'Fancy Notification'
size_hint: 1, None
on_release: root.do_notify(mode='fancy')
The basic uncommented lines of buildozer:
[app]
title = Notification Example
package.name = notificator
package.domain = notification.org
source.dir = .
requirements = python3,kivy==2.0.0rc4,requests,kivymd,pillow,urllib3,charset_normalizer,idna,plyer
icon.filename = %(source.dir)s/icon.png
I've tryed to change the icon to .ico ( have both on the Images directory ) and still the same issue. Also tryed to remove the app_icon arg from the notify() function and still the same issue. Also tryed to put the icons into the root directory and same issue.
Please, I've been looking for an answer but didn't find anything useful on the net. Any tip or solution ? Thx