cocos2d-X doesn't find android platform

10,864

Solution 1

These tutorials cover all steps:

http://www.cocos2d-x.org/wiki/How_to_run_cpp-tests_on_Android

and

http://www.cocos2d-x.org/wiki/How_to_Build_an_Android_Project_with_Eclipse

Solution 2

If

cocos run -s ~/MyCompany/MyGame -p android --ap 20

does not work (Using NDK r10b)

You can use command 'android list' to list all the available target platforms

For me, it is now:

cocos run -s ~/MyCompany/MyGame -p android --ap android-20

Solution 3

How to specify the android platform:

Use '--ap 19|20', e.g.,

cocos run -s ~/MyCompany/MyGame -p android --ap 20

Solution 4

This issue will occur when your environment variable not set properly, I suggest you to set your environment variables properly and then restart command prompt or terminal then execute cocos compile -s projectname -p android if your project compile successfully then you can run this project. hope this helps

Solution 5

In my case, I add the %ANDROID_SDK%\tools to my path, so the 'android.bat' file get accessible to cocos console. then cocos run will read the correct platform form file project.properties in your android project.

Share:
10,864
Filipe Ferminiano
Author by

Filipe Ferminiano

Updated on October 12, 2022

Comments

  • Filipe Ferminiano
    Filipe Ferminiano over 1 year

    I'm using cocos2d-X v3 and I created a new cocos2d-X project following this tutorial.

    But when I run

    cocos run -s ~/MyCompany/MyGame -p android

    I get this error:

    building apk
    Android platform not specified, searching a default one...
    Can't find right android-platform for project : "/Users/filipeferminiano/MyCompany/MyGame/proj.android". The android-platform should be equal/larger than 10
    
  • Narek
    Narek over 9 years
    Guess this appeared after cocos2d-x 3.1. I have just installed 3.2 and your way it worked! Thank you!
  • Neon Warge
    Neon Warge almost 9 years
    I am pretty sure people all people asking have already checked those resources.
  • Moberg
    Moberg almost 9 years
    So what does you ANT_ROOT variable look like? I can't get it to work properly, mine is C:\apache-ant-1.9.5\bin.
  • Neon Warge
    Neon Warge almost 9 years
    @Moberg, I got the same path. What error are you getting?