20 May 2014, 05:19
Generic-user-small

A Duval (2 posts)

First thank you for this interesting and complete book.

I actually having some problem with the code p38.

    String vertexShaderSource = TextResourceReader
        .readTextFileFromResource(context, R.raw.**simple_vertex_shader**);

String fragmentShaderSource = TextResourceReader

        .readTextFileFromResource(context, R.raw.**simple_fragment_shader**);

The ** ** part are underline in red saying that it “cannot be resolved or is not a field”, I have go on the project until I have to test the project, but now I can’t with this problem. I have also donwload the source code but I am facing the same problem. What can I do?

Thank you for your help.

22 May 2014, 19:27
Generic-user-small

Kevin Brothaler (36 posts)

Hi Duval,

One cause of this might be if you have a “import android.R” at the top of the file; if that’s there, try removing it and re-importing the R file from the project.

This link might also help:

http://stackoverflow.com/questions/7824730/r-cannot-be-resolved-to-a-variable

Please let me know if that helps out.

22 May 2014, 19:28
Generic-user-small

Kevin Brothaler (36 posts)

You could also try deleting R.java from the project’s gen folder, and clean / rebuild the project.

17 Jun 2014, 07:07
Generic-user-small

A Duval (2 posts)

My problem came from this import:

import android.R;

in the AirHockeyRender

By removing it, my problem is solved, thank you Mr. Kevin Brothaler.

18 Jun 2014, 23:55
Generic-user-small

Kevin Brothaler (36 posts)

Those pesky android.R’s; don’t worry, it still happens to me quite often in my daily development. ;) Glad that it worked out.

  You must be logged in to comment