Undefined error in extensions

Few months ago I made an extension

But suddenly it stopped working with this messageundefined

I didn’t change any code. I asked my other developer friends too they are facing the same issue. What could be the most possible reason?

Thank you.

OK problem solved. It was because of network operations on UI thread.

1 Like

Would you be able to give us a full stack trace? The error message shouldn’t be undefined here as it’s not particularly useful. If we know where the error is being caught then we might be able to provide a more helpful message to the user.

Sir, I was performing network operations on the UI thread. and after logging, I got to know that Android.os.NetworkOnMainThreadExeption exception was occurring. Then I started doing stuff in a separate thread and problem solved.

I fully understand the problem and the solution, what I’m trying to understand is why you ended up with the message “undefined” rather than something more useful. The latter indicates a possible improvement to App Inventor, but without seeing the full stack trace to know where in App Inventor the error was trapped it makes it hard to improve the experience for extension developers and users alike.

1 Like

Me too have same problem, my extension works with api and sent text to the api, I don't know why it's happening, when I use the main block Get Text I get error undefined.

Problem: You are running network operations on main thread.

Reason: You can't run network operations on main thread and if you do then since exception does not return any message so App Inventor shows 'undefined' message.

Solution: Run that piece of code in background thread.