I have a problem and want to help from you . I get some Cocos2dx source code I want to publish on the play store
I want someone to show me how to add Cocos2dx on eclipse on a Windows machine
so I will be able to publish those code .Please anyone able to tell me step by step what should i do ..
Thanks
Hello friend i am also working on cocos2dx .. and i have done setup correctly and its working for me ... i am going to describe what i have done........it may help for you as well as others
=============cocos2dx android setup guide=====================================
- check for these 6 things
1-> adt
2-> ndk
3-> cocos2dx
4-> Python
5-> cygwin (setup-x86_64)
6-> jdk
// now do all steps one by one
1-> first create a specific folder where you want to setup android
2-> copy all these files (which mentioned above)
3-> extract adt
4-> extract ndk
5-> extract cocos2dx
6-> install python
7-> install cygwin (to install this you need internet connection ..so follow the steps under -- how to install cygwin)
8-> setup environment variable for cygwin -----
-to set this open environment variable which you find mycomputer->properties->advance settings->environment variable
- now find path variable and add the path of cygwin ex-- mine ic c:/cygwin64/bin
- add another variable for ndk NDK_ROOT -> mine is F:\myworkspace\Android\adt-bundle-windows-x86-20130219\android-ndk-r10d
9 -> check for java (jdk) for eclipse , if not then install java
10-> set environment variable -> edit path ---add path for java ; C:\Program Files (x86)\Java\jdk1.6.0_20\bin;
at start of this path
11->you have done android setup ;
how to install cygbin
=============================
-> double click on cygbin file->click next->next->next->next->next-
-> now select mirror any one i choose http://cygbin.mirror.constant.com
-> click next
-> now u got select package -> search for the following one by one
autoconf, automake, binutils, gcc-core, gcc-g**, gcc4-core, gcc4-g**, gdb, pcre, pcre-devel, gawk, make
neccesory packages---> make
->and follow the instructions
======================================
finally ... you have done with setup now open elipse
import your project -race track->proj.android
import libcocos2dx---> CoCos2Dx\cocos2dx\platform\android\java
now open cygbin.bat file-> go to you project resourse directory -> run command -- chmod -R 777 *
clean your project and run
==============================================================================================================
CREATE NEW PROJECT IN COCOS2DX BY COMMAND PROMPT
==============================================================================================================
1-> open cmd
2->
go to path--CoCos2Dx\tools\project-creator ( MINE WAS F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\tools\project-creator)
now typing cd above path then press enter
now type f: press enter
3-> type command create_project.py -project MyGame -package com.sensiblemobiles.mygame -language cpp
then press enter
4-> you have done with this. a project is created in cocos2dx/projects folder
5-> now to add this project in adt follow istruction (HOWW TO ADD COCOS2DX PROJECT IN ADT
===============================================================================================================
HOW TO ADD COCOS2DX PROJECT IN ADT
==============================================================================================================
follow thest steps to import a cocos2dx project for android in adt eclipse
1-> open eclipse go to file->import->Existing android code into workspace (under android tab) ->click next-> click on Browse
2-> Go to your project root folder like MyGame->proj.android
3-> finish , your project will be added into project explorer
4-> to enable cocos2dx you need to import libcocos2dx follow above instruction same and go to root directory by following below path
-> CoCos2Dx\cocos2dx\platform\android\java (F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\cocos2dx\platform\android\java)
5-> now add this libcocos2dx in to your project
-> right click on your project ->properties->click android tab -> click add button -> select libcocos2dx -> ok -> apply ->ok
6-> Now to see your classes in this project follow below instruction
-> right click on your project -> properties -> explore resourse tab -> linked resourse -> path variables -> Now click on add (a dialog will be Open)
- Name : COCOS2DX
- Location : enter path of your cocos2dx (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx)
- click ok -> again OK
7-> you need some more steps below
-> right click on your project -> explore tab C/c++ General -> select Code Analysis -> select Use Project Setting -> now uncheck Syntax and Symantic errors -> apply -> ok
8-> Add path of cocosdension
again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> selsect Include Tab -> select GNU++ -> click on Add button
-> fill dialog box paste path of cocos2dx/cocosdension / include (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\CocosDenshion\include)
- press ok -> apply -> ok
9->Now go to Project Tab of adt -> clean your project
10-> finally you have done
=============================================================================================================================
NOW MAKE FEW CHANGES TO YOUR ANDROID.MK FILE
=============================================================================================================================
EXPLORE YOUR PROJECT -> JNI -> ANDROID.MK
NOTE : LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp
BELOW THE ABOVE LINES YOU HAVE TO ADD ALL CPP FILES LIKE ABOVE WITHOUT ANY SPACES
===============================================================================================================================
ENABLE BOX 2D IF YOU WANT TO USE BOX2D
===============================================================================================================================
FOLLOW ALL THE ABOVE STEPS TO CREATE NEW PROJECT AND IMPORT IT IN ADT ECLIPSE ;
NOW FOLLOW SOME MORE STEPS TO ENABLE BOX2D;
1-> right click on your project -> properties -> explore resourse tab -> linked resourse -> path variables -> Now click on add (a dialog will be Open)
- Name : Box2D
- Location : enter path of your Box2d (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D)
- click ok -> again OK
2-> now include box2d in include
again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> selsect Include Tab -> select GNU++ -> click on Add button
-> fill dialog box paste path of \CoCos2Dx\external\Box2D (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D)
- press ok -> apply -> ok
3-> now add Box2D source
again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> select Source Location Tab -> select Link Folder -> check the chek box
-> paste path of \CoCos2Dx\external\Box2D (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D)
- press ok -> apply -> ok
4-> change in application.mk file
EXPLORE YOUR PROJECT -> JNI -> application.mk
replace this line ( APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1)
to -- APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=0 -DCOCOS2D_DEBUG=1 -DCC_ENABLE_BOX2D_INTEGRATION=1
Note -> this will enable Box2d and disable chipmunk
finaly save this file
5-> change in android.mk file
EXPLORE YOUR PROJECT -> JNI -> android.mk
after this line (LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes) with "space"
add path of box2d like ($(LOCAL_PATH)/../../../../external/Box2D) after the line
Note -> this will include Box2d
finalLy save this file
6-> ok you have done with box2d . clean your project an enjoy... best of luck
=============================================================================================================================================
REMEMBER FEW THINGS
============================================================================================================================================
1-> ADD NEW CLASS IN CLASSES FOLDER
2-> ADD ALL RESOURCE INTO RESOURSEC FOLDER
3-> AFTER ADDING NEW RESOURE REFRESH YOUR ANDROID PROJECT THEN RUN (PERMISSION) COMMAND INTO CYGWIN
(cygbin.bat file-> go to you project resourse directory -> run command -- chmod -R 777 * )
Try these links
"How to run cpp-tests on Android" :
http://www.cocos2d-x.org/wiki/How_to_run_cpp-tests_on_Android
"The Completest Cocos2d-x Tutorial & Guide List" :
The Completest Cocos2d-x Tutorial & Guide List
"Cocos2D-X Tutorial for iOS and Android: Getting Started" :
http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started
In brief, you will have to
Install library for Java JDK
Install library for Android SDK&NDK
Extract Cocos2dx For Cocos2dx 2.2.x , you may use Cygwin. For
cocos2dx 3.x, you may use Python and Ant
Download and extract Eclipse
Installing the Eclipse Plugin for ADT
Import android project in Eclipse
Try build and run it.
In which step you are?
Related
I'm trying to test making changes to the Spoon source (trying to learn how it all works) but can't figure out how to build the final jar (with dependencies similar to the one available from the site) that we can then use to run independently.
I tried running the ./gradlew build and ./gradlew install with some minor code changes and everything builds successfully but I can't locate the JAR that works properly. :(
Any help / documentation related to the build/release process would be much appreciated.
Import project in Intellij Idea (not Android studio)
Import project from external model Gradle
Next -> Finish
Then you'll receive
Error:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Create local.properties file in root directory with following content:
sdk.dir=/Users/yourusername/Library/Android/sdk
If you see problems with gradle, press on gradle menu (tab at the right side) and click on synchronize/refresh button.
Open Project Structure -> Modules. Click + -> Import module -> spoon-client -> Import module from external model Gradle -> Next -> Next.
Do the same procedure for spoon-runner and click Apply.
Open Project Structure -> Artifacts. Click + -> JAR -> From modules with dependencies...
Select spoon-client, leave Main class empty, press OK.
Do the same procedure for spoon-runner. Click Apply -> OK.
Click Build -> Build Artifacts... -> All artifacts.
JARs will be created at the location you have specified in the Artifacts menu.
I created project with android/ and included core-2.3.0.jar in it's libs/. Set this project as library. Set my project include the library project. But when I finished setting and close the project property and open again, the project library change to a cross icon. Why?
If I ignore this and go to run my project, button clicked, exception: java.lang.NoClassDefFoundError: com.google.zxing.client.android.R$layout
Use this link https://stackoverflow.com/a/19293128/958850
In eclipse select Create a android project from existing source.
browse your zip file for android folder[this is a sample project
bundeled with the library] your project should be imported with few
errors
The actual core library is missing, We should add the ZxingCore
library from process 1
right click project -> properties -> JavaBuildPath(from left pane)
-> project tab -> add -> check ZxingCore - Ok.
All the errors should have gone now. it time to make the barcode
scanner app to be a library project
right click project -> properties -> android(from left pane) ->
check isLibrary -> apply -> OK.
Now you will get errors in some switch case statements. Convert the
problematic switch case statements to it..elseif
Your library project is ready
for those who want to run the barcode scanner as a stand alone app
skip the steps 5,6,7,8
there.
I noticed that samples on Google developers page can be imported on "Existing Android Code Into Workspace" menu on eclipse, not "Existing Projects into Workspace". I wonder how I can export my project as android code like the samples. I tried to find out that feature on eclipse but failed. Can you tell me how to do it please? And what is good to export as android code not existing projects?
by this step in your ADT,you will get your project as a Zip file.
Right-click, Export -> General, Archive File -> Next -> provide the output path -> Finish.
to get as a apk then try this step
Export -> Android -> Export Android Application ->
YOUR_PROJECT_NAME ->
Create new key store path -> Fill the detail -> Set the .apk location -> Now you can get your .apk file
You need to export to apk file. Refer here : here and also here
I'm trying to build this project https://github.com/OnlyInAmerica/Osmdroid-Plus/wiki to a JAR but I can't. I followed the "Configuration" steps in there and alredy have the Tomcat ant command to build, but it says "build.xml does not exist!" and ant -v command doesn't work either or creating a build with eclipse. I export it as jar with eclipse but using that JAR gives me an error in my project "Conversion to Dalvik format failed with error 1".
have you try this? :
Right click on project -> export -> select under "java" -> select path -> finish
this step would create a jar file for your project.
to use the jar into another project:
Right click on your project -> Build Path -> Add external archive -> select the jar file
I have certain knowledge in Android and I would like to learn OpenCV,for this I have followed several tutorials and ended up doing the following steps.
1. Download an eclipse for C/C++ developers
2. Added the Android plugin
3. Set the path for NDK
4. Downloaded OpenCV Library and samples
5. Imported the library and samples in the eclipse
6. installed OpenCV manager in my device
But, to my dismay,a cross appears in the library folder and all other sample folders shows a foot-mark or build error, which step am I missing out. Please help. Thx in advance.
Right click on project -> properties->android. Add android library to your android project
Add opencv library into your project. Right click on project -> properties->android add library
To convert project into c/c++ project
Right click on project -> New -> other -> c/c++ -> convert to c/c++ project
If you have converted your project into c/c++ project ensure as follows
Right click on
project -> properties->c/c++ General -> Paths and Symbols -> includes -> GNU c and GNU c++ add the path E:/android-ndk-r8d/platforms/android-14/arch-arm/usr/include
Similar to this
Also add the path C:\OpenCV-2.4.5-android-sdk\sdk\native\jni\include as above