Yesterday and I was writing a test script for creating an Android apk. This, of course, comes as no surprise since I’m in the Amazon Appstore. (We’re hiring by the way… just saying…)
No problem you say.
I wrote the program and it worked around 1/3’s the time.
I would run it and it would give me strange Java compiler errors most of the time. But it worked often enough to keep me going down the path of debugging it.
The 50k’ description is that this script was calling an underlying program to do the heavy lifting. Whenever I ran it myself it always worked just fine. When the script ran it, not so much.
That’s when I realized the problem: I was creating the class name of the main project randomly. It was a 16-length hex string.
Think about it for a sec.
– = –
Java identifiers must start with a letter. Conversely, they can’t start with a number. As it turns out hex is 10/16ths numbers. Hence, around 2/3rds failures.
Assumptions… that things work the way you assume they work. Yeah… not so much.