Hi-
I've been using Making Musical Apps to get into libpd, and I've run into a problem when making the Guitar Tuner example.
I'm able to run the example apps that come with libpd (Circle of Fifths, PdTest, etc. all work fine), but when starting my own project -in this case the Guitar Tuner- I get a bunch of errors. Among them:
AudioParameters cannot be resolved
File cannot be resolved to a type
IOException cannot be resolved to a type
Log cannot be resolved
PdUiDispatcher cannot be resolved to a type
R cannot be resolved to a variable
The markup in the document following the root element must be well-formed
The method initPd() from the type GuitarTunerActivity refers to the missing type IOException
The method loadPatch() from the type GuitarTunerActivity refers to the missing type IOException
...
I've tried cleaning, and I've tried simply restarting the project from scratch and still I get the errors.
It looks like your project is not an Android project. How did you create it?
I did File -> New -> Project... and then from the Android folder I chose Android Application Project
Not sure what's going on here, but it doesn't seem to be related to libpd since you seem to be missing basic Java classes like File and IOException. Try creating a simple hello-world Android app and see what happens.
Well, I feel stupid. Forgot to import everything. Problem solved.
FYI: You can have Eclipse generate imports for you. If you use autocompletion for class names, Eclipse will automatically add the corresponding imports. Alternatively, you can type Ctrl-Shift O and Eclipse will go over the entire file and choose the appropriate imports. I profoundly dislike Eclipse, but this particular feature is kind of nifty ;)
Thanks for the pointers. Eclipse can definitely be a struggle. It generated some imports initially (hence, the reason I didn't check to see if any were missing). At one point I definitely tried Ctrl-Shift-O but apparently it didn't do what it was supposed to because I added the imports manually. Anyways, I'm just happy to have things working.
I have the "R cannot be resolved to a variable " error. I have tried to clean the project, disabled autobuild and the android build target is 2.3.3 Eclipse suggests importing 'R'(android) but that gives me more errors. The CircleOfFifths app looks very similar and there is no problem. Anny Ideas of how to get rid of the error?
Typically, when Eclipse can't resolve R, that means that something else is wrong somewhere and that's why R.java wasn't built. Did you recently add or change a file under res/? That would be the first place to check. Also, look at the Problems tab and see whether it gives you additional information on what's wrong.
This can be a frustrating issue to resolve, and it's one of many reasons why I dislike Eclipse so much. The time saved by Eclipse's amazing features is eaten up by its equally amazing failures, and it's really hard to deal with the problems because Eclipse is so big and complex and it puts so much distance between you and what's really going on. Good luck!
Thanks, I put the tuner.zip file under /res/raw (I had to create a /raw because there was none) is there anything else I have to do after besides refresh the project in Eclipse?
Sorting out the "R cannot be resolved" problem usually involves a fair amount of thrashing around. I have yet to discover a scientific way of dealing with it. I think this is more about Eclipse than it is about libpd; maybe you'll get a better answer if you take your question to stackoverflow. If you do, please report back here ;)
Well, I created a new project, pasted the same code and there was just one error with the word tuner. Then I created the /raw folder and copy tuner.pd and there are no errors anymore :) Next part, Connecting the User Interface...
It looks like you're new here. If you want to get involved, click one of these buttons!