2014년 12월 7일 일요일

How do testing with the "right-click Do It" tool in AI2?

I wanted to test/deubug my application. I found there is a "Do It" option in the menu, but I could not use it.
All I got was an Error from Companion: java.lang.RuntimeException: invalid syntax in eval form:<string>:1:91: first set! argument is not a variable name

Is the "Do It" function working now?
Is there a way in AI2 to see how variables are changing ? (I have read about a watch feature in AI Classic)



There is no watch feature in AI2, but you can always use the DoIt from almost any block.  You cannot see variables changing, but you can always check them with DoIt.

In your error there, that appears to be a string error where the variable name is not correct... If you get an error in your DoIt, there's an error in your code.

The DoIt function is always working and has worked perfectly from AI2's inception.



See Testing Individual Blocks in this article http://www.appinventor.org/Chapter15   for an explanation of DoIt.

DoIt  is working in AI2.

DoIt is the AI2 'equivalent' of the watch feature in AI Classic.  The other debugging tool in AI2 are the yellow and red triangles used in the Blocks screen -- see below.

You got an error?   OK ...could you show a screen capture of the blocks you 'tested?'   This is a big guess ..".first set! argument is not a variable name"   probably means you have a coding error .  Find the block in your code that has a red triangle and fix it.   Red triangles always inhibit creating an apk or running a project in the emulator or possibly creating an aia file.     Yellow triangles are more forgiving, however, sometimes, these need to be fixed because they trip an internal warning and you do not get a compile, so fix the yellow triangles too.



Thanks for your input but I still have this issue. 
I have attaced my code: it will just multiply X by 2.

Before selecting "Do It" everything is green, the app works in the emulator as it should.
When selecting do it, I get an error.
This is the whole program actually. 

What do I do wrong?






the Do it feature is limited, it does not work with local variables
I simplified the blocks a little bit for you, see screenshot
there is also no need to use another local variable in the button click event, in this case just use the label instead



댓글 없음:

댓글 쓰기