how to export android code - android

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

Related

how can I import project as *.APK file in my Android phone?

I have created one project for android phone, how can i import project as APK file for android or is there any other way to make installation file...plz
Try hope it wil help
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

How to import cocos2dx project in eclipse

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?

How can I import/run an android project to eclipse?

I am trying to import an example project into eclipse. I downloaded the file SlidingTabsColors.zip from here, unpacked it, and then choose
Import -> Android -> Existing Android Code Into Workspace -> Browse -> ...
and selected the project named 'MainActivity'.
When I try to run this application the Console gives an error:
Could not find MainActivity.apk!
I thought the purpose of eclipse is to create the apk file...
Anyway, do I need to do some additional steps in order to run this example?
Do:
New -> Other -> Android Project From Existing Code
This should work no problem. Android does create the APK upon a successful compile. If you run into any issues, just do:
Project -> Clean
Here is a step-by-step tutorial on Tab Layouts with Swipeable Views. Which is what I believe you're trying to achieve.
Download Link: Source Code
Hopefully this helps.
Make a New folder in your computer.
put the java and res files in that new folder
just rename the folder from java into src
copy the AndroidManifest.xml into the root folder
now try to import this from eclipse

Create JAR from Eclipse Project

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

How to use and package a JAR file with my Android app?

I have an API in the form of a JAR that I would like to use in my Android app. Not sure if it should be part of the project in Eclipse or kept separate and added to the project properties. This JAR also needs to be packaged with the application, so how is that done for Android apps?
As explained by this SO question:
Your Project -> right click -> Import -> Archive File -> yourjar.jar
Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar -> yourjar.jar
You must add it as "external JAR" files, and set the "Order and Export" in your Eclipse project.
Update February 2012:
Pacerier mentions in the comment having an issue (ClassNotFound) even though he did declare the library.
He had:
However, the solution was simple:
Over 1 hour wasted. Man was I pissed!
Solution: make sure your JAR is compiled with 1.6 and not 1.7.
Argh
Thanks to VonC for pointing me in the right direction. I had the same symptoms but for a different library (I needed to add org.apache.commons.codec.binary.Base64 for an Android project). The solution that worked for me was SLIGHTLY different. Herewith the steps that I followed:
Download library from http://commons.apache.org/codec/download_codec.cgi
Extract commons-codec-1.6.jar from the tarball and copy to a local
folder
In eclipse:
right-click project name
choose "Properties" from context menu
on "Libraries" tab, select "Add External JARs..."
navigate to and select commons-codec-1.6.jar from the location you extracted it to your local drive
The jar file will now appear under "referenced Libraries" in your Package Explorer and you will be able to reference the library in your code.

Categories

Resources