syntax error, unexpected tCONSTANT, expecting end-of-input - android

I'm having some issues defining my own steps using Calabash-Android and Cucumber.
My step definition file contains
require 'calabash-android/calabash_steps'
Given /^I wait for obb download$/ do
pending
end
And the error message I am getting is
Calabash-Android/features/step_definitions/calabash_steps.rb:1: syntax error, unexpected tCONSTANT, expecting end-of-input
Given /^I wait for obb download$/ ...
... ^ (SyntaxError)
I have tried using the Given and When prepositions and no matter what I put inside the do block, I get the same error. When I comment out requires, it will run, but crash when I get to that step. It also works when I comment out my step definition and remove my step.
I have also tried every combination of / /^, /, $/, and "" and I still get the same error.
Any assistance would be appreciated. Thanks.

Related

using strings.xml with %, $ and / and formatted

I added this line to my strings.xml, and it wont compile into R.
<string name="cl_txt_verinfo">List Version: %1$s\nAuthor: %2$s\nDate Created: %3$s\nLanguage: %4$s</string>
the errors i get are:
error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
error: Unexpected end tag string
I want to ask how to make this work(i will use string.format later)
and what does "formatted=false" do as opposed to not adding it/add it as true.
Edit:
Clean and build is how I got this error. I got it so many times.
But then I deleted an empty line and clean and rebuild everything is fine.
This is really inconsistent and i have no idea what's causing the problem in the first place.
Two questions left:
Could someone still tell me what difference would "formatted=false"
make?
How did I got this kind of behavior?(reporting error when there's none and i try to fix it by blowing things up and create a mess)
This is not the only time i had an error then it magically fixes itself. sometime i restart my adt and it resolves itself, but not this time sadly.
If you added formatted=false then format specifiers(%,$ etc.) in your string resource are disabled and Formatter won't be able to recognize them. This will definitely help you.
For your 2nd problem there is no exact solution but what I do is delete gen and bin folder and then clean build project. What happens is every time you build a project, android checks if there is any new resource available and adds it to R.java and only after that you can use it.

Android app error: W/ResourceType( 8276): ResXMLTree_node header size 0 is too small

This is a working android app that I pulled down from subversion and fired up in Eclipse ADT. I am getting this error:
W/ResourceType( 8276): ResXMLTree_node header size 0 is too small.
I am not sure what it means or where to begin to debug this. This error is appearing in my console window within Eclipse.
Any help would be appreciated.
For me, I was given this error from a character I had accidentally entered into my xml editor. Unfortunately Eclipse often does not highlight the file or line with a red x so it can take forever to track the error down.
If you use source control look through all the xml files you have changed and make sure that none of them have any xml formatting errors.
You can use a tool like this to validate each of the xml files that you are concerned about:
http://xmlwrench.com/online/
NOTE: if you add an extra character at the end of a line these validator tools will not catch it.
Try looking in the generated R.java file to see if there is a line highlighted with an error.
For me gen/R.java showed that one of my drawables had an illegal name (it started with a number).
It should be caused by eclipse encoding. You can check this by
window -> preference ->Content Types ->Text ->xml
Please make sure it is encoded as utf-8

Android SDK false syntax error "Syntax error on token "}", delete this token."

So I'm trying to complete Google's "My First App", and have gotten everything to work up to this point. However, I am receiving a false error on two of my brackets.
I am not allowed to post images for some reason, so here is a link to my screencap (which I thought appropriate as it highlighted all the errors): http://imgur.com/0BYjZ2X
I have cleaned the build, rebuilt the project, restarted my computer, completely wiped the code, and repeated in all manner of orders to no avail. Someone here experienced a similar problem on an older build of the ADT plugin: Syntax error on token "}", delete this token
Any help would be greatly appreciated, as three hours of my time and a lot of caffeine haven't made a dent in the problem.
Android SDK false syntax error “Syntax error on token ”}“
I think its not false syntax error. You need to put the sendMessage function inside the } quote at line 29, which is showing the error. Your function is outside the Activity. That is why it is giving the error since last 3 hours :).
From the screencap, your class ends on line 29, and the sendMessage method is outside the class. Put the sendMessage method inside the Activity.
Remove the "}" from line 29 and add it to the end of the code..:)
The class should end after send message function. All the code for the class should be within that class.
So move the } to the end of the file.

I am getting error in R.java .Do not know how to proceed?

I am getting error with the generated java file. But the code is fine and good . Can any one give suggestion.
thanks in advance.
Based on your image it appears that you are getting an error with the element with id of "enter", try changing the id of that element to something more descriptive and the error might go away.
You don't say which error you are getting. Usually you can resolve errors in R.java by removing it, and letting Eclipse regenerate it. If you still are getting the same error, you can try to rename the controls with the offending id.
If you wish further assistance, you need to say which error you are getting.

Problem with system() call

I am using a system() call in a program , that is in c library. For 1st 9 calls it returns '0'(zero) after 10th call it returns 256. I do not know what does it mean. Please anybody help me. Following is the line of code
int returnValue= system("/system/bin/cat /dev/graphics/fb0 > /tmpdata/Screenshot/screenshot.bin");
According to this man page dealing with the general unix cat command, an error code >0 simply means an error occurred.
The following exit values shall be returned:
0
All input files were output successfully.
>0
An error occurred.
Your system() call is attempting to concatentate two files, so perhaps there is a space issue or maybe the source file does not exist.
You may also wish to take a look at some recent source code for Android cat (cat.c) which gives some indicatations of the kind of things that trigger errors within cat.

Categories

Resources