Debugging component in App Inventor

380 views
Skip to first unread message

Rachael Thompson

unread,
Jul 1, 2016, 9:16:26 PM7/1/16
to App Inventor Open Source Development

Hello,

This is my first time building a component for app inventor. I want to be able to use an OTG gamepad controller in my app, which is eventually going to be used to control a robot through bluetooth. After looking at the tutorials, as well as some source code from the FTC App Inventor version, which has an equivalent component built in, I've got a simple GamePad component that compiles just fine, and shows up with all its properties in AI. But when I incorporate it into a project, the resulting app won't fully build - the text doesn't show up on any labels and buttons, and while no errors appear, the project's code doesn't run either (ex. an "if(true) do X" statement will never do X). Pressing "a" on the gamepad still clicks the selected button, pressing "b" exits the app, etc.

I suspect the issue has to do with the Qualcomm Gamepad.java class I'm using (saved as part of a library, and so far unedited), but I don't know a good way to find out what the exact problem is. I'll post the relevant files here in case anyone has some insight, but my real question - what's the best way to debug your component in AI? Is there a way of creating a visible error message when something fails? Or some other way of figuring out what's going on?

Thank you!
Gamepad.java
GamePad.java

Jeffrey Schiller

unread,
Jul 1, 2016, 10:53:28 PM7/1/16
to app-inventor-o...@googlegroups.com
Take a look at any of the components in components/runtime. Most components have some logging code in them. Log output is sent to the device's system log which can be examined with the "adb logcat" command on a device connected via adb.

-Jeff
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at https://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.


--
_______________________________________________________________________
Jeffrey I. Schiller
Information Systems and Technology – MIT App Inventor
Massachusetts Institute of Technology
77 Massachusetts Avenue  Room 32-386
Cambridge, MA 02139-4307
617.910.0259 - Voice
_______________________________________________________________________


Rachael Thompson

unread,
Jul 2, 2016, 3:08:36 PM7/2/16
to App Inventor Open Source Development
 That showed me the error. It looks like my component can't find the library b/c I've got the wrong path in the import statement, so I'm going to look at that. Thanks!

Francesco Montefoschi

unread,
Jul 9, 2016, 5:51:04 AM7/9/16
to App Inventor Open Source Development
Hi Jeff,
is it possible to debug the companion runtime with a real debugger (eg. Android Studio) instead of using Log.d?

Francesco

Reply all
Reply to author
Forward
0 new messages