I have started learning Coco2d-x and want to run the sample app on my android phone. I have imported sample project Hellocpp in my eclipse and fixed the library path. I am able to install it on my device but when i run it i get below error.
I am following this tutorial: coco2d-x
Please help me out.
Are you sure you have the linked the source cocos library to your project in the java build path. and if so. please check your environment variables for COCOS2DX_ROOT,NDK_ROOT.
1: In Eclipse, right-click on your project and select the last option "properties".
2: In Project Properties window, select "Java Build Path" in the left pane.
3: Under Java Build Path, select tab "source". It should be selected by default.
4: Click on button "Link Source"
5: Browse it to following location-> COCOS2D-X_INSTALLATION_FOLDER/cocos2dx/platform/android/java/src. My path will be: E:\cocos2d-x-2.2\cocos2dx\platform\android\java\src
6: Give any folder name. For example, remove src and replace it with: Cocos2d-x-source. Click Finish.
We are done now. Run your poject on an Andorid Device and it should show you the nead cocos2d-x logo. Please note that running this in an Android Virtual Machine may not always work.
If there is an error after the project has been imported and build like:
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml eclipse
You can change the Eclipse settings by following these steps, provided by a someone from Google (at this link) (but also, see my IMPORTANT note below):
IMPORTANT! What the Google guy didn't note is that you also need to use the "Move Up" button in the settings to move your new rule to the top because otherwise some other more generic rules overshadow it and it doesn't work.
In eclipse:
Window -> Preferences -> C/C++ -> Build -> Settings
Select CDT GNU C/C++ Error Parser
In the Error Parser options at the bottom, add a new entry with the following contents:
Severity: Warning
Pattern: (.?):(\d+): Android NDK: WARNING:(.)
File: $1
Line: $2
Description: $3
I am trying to run an OpenCV4Android in my eclipse. I am working on Linux(CentOS 6).
I have done everything mentioned in this link but I am still getting build errors. I have also set the NDK path in preferences hat is not mentioned in the tutorial and tried a lot more things. When I try to build the library project the console gives:
"Cannot run program "/ndk-build": Unknown reason
Error: Program "/ndk-build" is not found in PATH"
All the projects also have build errors and the src and gen folders in openCV4 Library is not created and the build path shows:
"Unable to get system library for the project"
When i try to change the project properties I get an error saying the page contains invalid values and I cannot change the android api version. Plz help. Have been trying to set this up since 3 days now.
Thank you.
First Clean and Build you library Project alone and then try cleaning all your projects. In order to solve the "Cannot run program "/ndk-build": Unknown reason Error: Program "/ndk-build" is not found in PATH" error, Try the following steps:
Head to the project's properties. If you're using Windows, the shortcut is Alt + Enter; or simply right-click the project name to find its properties.
Go to the C/C++ Build section; under Builder Settings tab in Build command: text box you're likely to find something similar to that below, if it's empty then type in the similar text - namely: ${NDKROOT}/ndk-build.cmd where NDKROOT, as its name implies, refers to the path where your NDK root folder exists.
Now you must inform eclipse what NDKROOT equates to; as in, where is the NDK root path. You can do this by heading to (in your project's properties) C/C++ Build > Environment > press Add…
Now add your environment variable named NDKROOT (the Name) with the relevant path (Value). Note that you're to repeat this per NDK project. You would get a window similar to that below.
Press OK to the New variable input window and then OK again to the properties window.
Hopefully this will help!
Today i was update my android sdk to new android adk-17 .
i am facing some problems in this, that is unable to show AddMob in my app, if i remove addmob in the code able to run the app without any errors otherwise not. what is the solution for this, is this bug in new sdk.
this is the Logcat information
Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader
dalvik.system.PathClassLoader[/data/app/com.veritra.iflipout-1.apk]
Maybe the ADK update has messed-up with your project's build-path.
Try removing the admob JAR and add it again to your libs folder, add it to your Build Path and do a Clean Project.
Anyway it's hard to help you without more details on the error you encounter.
EDIT following poster's comment about not having a libs folder:
You should try this:
Remove all references to the AdMob JAR in your project -> your code should not build without error anymore
Create à libs folder at the root of your project
Copy the AdMob JAR into the libs folder
Make sure this AdMob JAR is in your Build Path (this will allow your code to build wihtout error)
(If still not running OK) Right click your project > Android Tools > Fix Project Properties
The 'problem' here is that the SDK is a lot more strict about the libraries. If you do not check the library as 'exported' in eclipse, it is not added to your APK, leading to this nasty class not found exception. You should mark your libraries as exported.
Project Properties | Java Build Path | Order and Export
when I updated my SDK it was total mess. Well, the only I had to change was the PATH in Environment Variables.
http://developer.android.com/sdk/installing.html :
Adding both tools/ and platform-tools/ to your PATH lets you run command line tools without needing to supply the full path to the tool directories. Depending on your operating system, you can include these directories in your PATH in the following way:
On Windows, right-click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path (under System Variables). Add the full path to the tools/ and platform-tools/ directories to the path.
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to the tools/ and platform-tools/ directories to it. If you don't see a line setting the path, you can add one:
export PATH=${PATH}:/tools:/platform-tools
On a Mac OS X, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile if you don't already have one.
I have been working with Android SDK for a while & just came across an requirement to use the NDK
So, I downloaded the Android NDK for Windows. Jumping on the first example, when I am trying to build the library using the process defined in the NDK example
http://developer.android.com/sdk/ndk/overview.html
Specifically the command /ndk-build from the command line
I am getting the error
ndk-build is not recognized as an internal or external command, operable program or batch file
I have added the path for ndk-build in the PATH variable and even tried calling the command going to the folder, still the same error
Does anybody have a clue?
Guess that should have been an answer instead of a comment.
You must use Cygwin as your shell in order to run ndk-build.
See http://www.cygwin.com/
Once you have Cygwin installed you can have Eclipse automatically build your project for you by:
Right click on your project, pick properties.
Select "builders" from the left-hand list.
Click "New..." on the right side.
Select "Program" as the configuration type. I name mine "Native Builder"
Location - c:\cygwin\bin\bash.exe
Working Directory - c:\cygwin\bin
Arguments -
(for NDK r3):
--login -c "cd /cygdrive/c/Android_NDK && make APP=myapp"
(for NDK r4):
--login -c "cd /cygdrive/c/ && /cygdrive/c/Android_NDK/ndk-build"
Make sure you have the two hyphens before login and the quotes after the hyphen-c
Now go to the refresh tab
Check "Refresh resources upon completion"
Select "Specific resources"
Click on the "Specify resources" button and select your project's
lib directory.
Check "Recursively include sub-folders"
Now go to the build options tab
Check "Allocate Console"
Check "Launch in background"
Check "Run the builder After a Clean"
Check "Run the builder During manual builds"
Check "Run the builder During auto builds"
Check "Specify working set of relevant resources"
Click on "Specify Resources"
Select your project's JNI directory and all files within.
Now click OK on the bottom.
Now you can edit and save in your c files and it will compile and create the .so file on the fly.
Maybe, your development IDE hides system PATH and uses it's own PATH. I had same problem with MOTODEV Eclipse for Android 3.1. Detailed solution is here: How to solve problem with Motodev Eclipse for Android 3.1: wrong PATH It is for MOTODEV IDE, but Eclipse may have same thing.
I finally was able to build and debug the android platform with this tutorial. I imported my project in eclipse, and afterwards installed ADT. Then I converted my imported project to android project (Android Tools -> Convert To Android Project). And now I'm having Failed to load properties file for project 'droid-platform' error. Session data:
eclipse.buildId=M20100211-1343
java.version=1.5.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=ru_UA
Command-line arguments: -os linux -ws gtk -arch x86
Does anyone know, how do I deal with this?
Use the contextual menu on the Project in error, "Android Tools"-->"Fix project properties", I also tried "Refresh (F5)" in the same pass, than it worked again.
ADT does not work good with the platform itself. Actually, the platform is not an android project itself.
I really struggled with this one and finally solved it using the solution here:
"Debug certificate expired" error in Eclipse Android plugins
I also had the error message you mention, but somehow, deleting the keystore fixed everything.
p.s. do a clean after deleting the keystore.
Yusuf
The solution to this problem is to setup some System Environment Variables.
Right click on "My Computer" and select "Properties"
Select the "Advanced" tab
Click the "Environment Variables" button
Under "System Variables" find "Path", select is and then click "edit"
Scroll to the far right, now you need to add two paths, "C:\Documents and Settings\YOUR_USER_NAME\.android\avd" and "C:\Program Files\Java\jdk1.7.0_01\bin", you need to add a ; at the end of each path. Click "Ok" when done.
Select the "New" button, for variable name enter "ANDROID_SDK_HOME", and for variable value enter your SDK install path (Default is "C:\Program Files\Android\android-sdk") and then click "Ok"
Restart Eclipse and it should work!
on my mac, with Eclipse and the Android AVD exited,
1) i deleted all projects in my workspace (backup first!),
2) recreated it with the same workspace name and
3) finally restarted eclipse and a new project setup works fine without the "Failed to load properties.." msg.
So easy just choose the project that has an error, and then go to menu>project>build Project
Just create a new file called project.properties in the root of your project.
Add the line:
target=android-10
Or modify it to whatever version of the Android you're targeting.
I got the a similar error When following the Notepad tutorial on the Android Developers website, the first step in Exercise 1 is to create the first project by going to
File->New->Android Project-> "Create project from existing source"
The problem is that when you select the Notepadv1 path to create the project from existing source, Eclipse will take the project out of the parent folder and move it up a level. For example, if you select
C:\workspace\NotepadCodeLab\Notepadv1
... as the existing source, Eclipse will copy all the contents of that subfolder except the AndroidManifest.xml (and Android.mk file) into a new folder one level up, eg.
C:\workspace\Notepadv1
So one workaround is to create the project, close Eclipse, then copy in all the missing files from the old subfolder to the new folder, then open Eclipse again and refresh the folder.
Presto, no more missing files.
In my case, I just add to import the R.java (ex:import com.exercise.teste.R;) to my class files by right clicking on ex: R.id.mybutton and choose import ex; your.package.name.R, then CLEAN, BUILD.
What fixed the problem for me was going into eclipse sdk manager and installing the tools there even though I had them installed on my sdk manager. It seems that there 2 separate sdk managers with different files, so try directly going into the sdk manager in Eclipse and seeing if you have the tools installed there.
I had the same problem, and without installing AUSKey only corrected the error by removing the log4j.jar / Library / Java / Ext on Windows (\C:\Program Files\Java\jre7\lib\ext) was fixed. In my case, the solution was like this:
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=54452
I had this error when I manually tried editing the manifest file, "AndroidManifest.xml". When I made changes using the little GUI provided for editing the file, it works fine.
Make changes via the Manifest General Attributes and Manifest Extras sections that opens up when you double click the "AndroidManifest.xml" file. Yet beware of changes made directly to the xml, even if they are identical!
I was facing the same issue but I finally got the solution:
Right-click on your Eclipse project.
Go to Build Path->Configure Build Path->select Android from left side.
In Library section select and remove the existing v7 library
Add it again from your imported v7 project.