Forum > C++ > trouble creating a new android project

trouble creating a new android project

By hullabal00 Posted 2011-10-21 15:35 Comments 6
  • Posts: 1

Hi. I’ve looked all over for similar problem but can’t seem to find the answer so I’m hoping someone could help me.
I ran in mac terminal and it works fine. I run and there’s no errors. Then I create a new android project in eclipse from existing source code (the directory that I created from the shell script) but I get a few errors.

In the androidmanifest.xml file, the line “android:icon=”@drawable/icon“>” it says no resource is found. That is simple enough to solve. I just copy the icon.png file into the res/drawable dir.

In the <ProjectName>.java file, these 3 lines have errors:
mGLView = (Cocos2dxGLSurfaceView) findViewById(;

Right now, it can’t find the R. But I noticed in the HelloWorld sample, it doesn’t have the “import android.R” line. How do I fix this?

I assume if I just run that simple script, it would generate the HelloWorld sample code for me to start with, and there would be no compile problems. Did I miss a step or overlook something. Would appreciate any help.

BTW, I am using cocos2d-1.0.1-x-0.9.2. Thanks.

  • Posts: 2082
  • Location: Xiamen, China

#1 RE: 2011-10-22 05:53

Build the android project in eclipse, then the will be generated.

  • Posts: 1

#2 RE: 2011-11-17 03:36

I occur the same problem while creating a project from exsisting source.

If you config your Enviroment with android-ndk-r7+android-sdk_r08-windows+jdk1.7, you will occur:
1. cannot compile prpjects when bash ./
2. the same problem with you, can’t find the and “android:icon=”@drawable/icon“>” error.

You should do this:
1. open cocos2d-1.0.1-x-0.9.1\cocos2dx\, change

  1. After creating your project with Eclipse, right click your project—properties—Java Compiler—select “Enable project specific settings” —select “Compiler compliance settings”,set to“1.6”—Apply, that is all.

I think this will help you, I am so sorry with my poor English.

  • Posts: 16

#3 RE: 2011-11-22 22:53

i have the same problem, i did all in this article “\_1*-*How\_to\_Create\_a\_New\_cocos2d-x\_project\_on\_multi-platforms”. but i can’t find the var “game_demo” in R.layout, and the same of others. is it the version of android, i use android 2.1-update1(target: 3);

  • Posts: 16

#4 RE: 2011-11-22 23:00

i’m sorry, before i build the project, i found there are some errors, so i import android.R to the file, so the errors appear, i remove “import android.R” the errors are solve.

  • Posts: 1

#5 RE: 2011-11-22 23:11

That is some problem with, see Bug #866.

Before the bug be fixed,you can copy the lost file and dirs from HelloWorld project to make your target project work.

  • Posts: 28

#6 RE: 2012-09-05 18:03

Hi there ,

i’m having a similar problem , but only when i import a exter sdk in my android project.
actually im trying to integrate the Gree Social Platform with cocos2dx android , when i do this , the same error of the R.XXXXX compilation appear.


I’v clean and build , even restart the computer kkk , but the error 100% is in the import of SDK , somehow this import override the R compilation class.

Any Idea? i’v already post in Gree forum , but nothing.


Honghui Zhang wrote:

That is some problem with, see Bug #866.
Before the bug be fixed,you can copy the lost file and dirs from HelloWorld project to make your target project work.

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps