Sketchware-Pro / Sketchware-Pro

Sketchware Pro's sources in Java. Now anyone can contribute to Sketchware Pro.
https://sketchware.pro
Other
863 stars 254 forks source link

SketchLogger Error With Custom Application Class #558

Closed AndroXStudiO closed 1 year ago

AndroXStudiO commented 1 year ago

i got this error when i am using Custom Application Class

Screenshot_2022-08-31-14-13-42-70_530cacab4ad0eed970d4085057c2e61d

maybe that issue occurred for this line

IMG_20220831_141330

AndroXStudiO commented 1 year ago

when i used Custom Application Class its not change with sketchLogger class......see that screenshort. after changed SketchApplication to my custom, but its still available at SketchLogger.

sorry for my bad English 🙂

JavkhlanK commented 1 year ago

I feel like it should be expected that things are gonna stop working when you do that, and that the user's advanced enough to fix those issues on their own if they change the application class name. Anyway, show your custom application class, looks like it's returning null in getContext() which obviously breaks the toast.

AndroXStudiO commented 1 year ago

See my CUSTOM Application class

Screenshot_2022-08-31-14-37-22-72_423e58f25c30a02453fa5d8c82fc37f2 Screenshot_2022-08-31-14-37-28-35_423e58f25c30a02453fa5d8c82fc37f2 Screenshot_2022-08-31-14-37-34-22_423e58f25c30a02453fa5d8c82fc37f2

JavkhlanK commented 1 year ago

Seems fine. Maybe you changed SketchLogger to not work anymore then. Can you show it, maybe as file this time?

AndroXStudiO commented 1 year ago

Screenshot_2022-08-31-14-45-56-69_9e8df3d0c7c1f50248b6ee043a653d26

AndroXStudiO commented 1 year ago

"Maybe you changed SketchLogger to not work anymore then. Can you show it, maybe as file this time?"------------ i'm not understood this line

JavkhlanK commented 1 year ago

How did that file even compile? You used a different application class that's not SketchApplication.

AndroXStudiO commented 1 year ago

then what is my problem and how to solve it?

JavkhlanK commented 1 year ago

Try replacing all SketchApplication references in SketchLogger.java with your custom application class' name.

AndroXStudiO commented 1 year ago

SketchAplication class still available after used own application file.

Screenshot_2022-08-31-14-53-00-18_9bde489fb18d43e8729607528f1e9d52

AndroXStudiO commented 1 year ago

already i have converted all SketchApplication codes with my custom application

JavkhlanK commented 1 year ago

Alright I think that's why it compiled. Still try changing SketchLogger though, that should fix your problem,

JavkhlanK commented 1 year ago

Upcoming bugfix will not generate SketchApplication.java when a custom application class is in use, and replace uses of SketchApplication in generated files like SketchLogger with the custom application class. Automatically adding methods like getContext() to custom application classes won't happen though, at least not for now.

AndroXStudiO commented 1 year ago

then how to change SketchLogger?

using JavaManager i have to write my own SketchLogger?

JavkhlanK commented 1 year ago

Using Java Manager, yes. Just copy the file that got generated.

AndroXStudiO commented 1 year ago

Using Java Manager and Own SketchLogger class...its fix my issue ❤️ for now.

JavkhlanK commented 1 year ago

Should have been implemented with commit 09a45b7bf4b296260b3f87805e4baa75afb15396.