Michael
Michael

Reputation: 7123

Cocos2d-js: “Can’t find right android-platform for project”

I changed to new versions of Android SDK and NDK.

When I execute the command "cocos run -p android" in any cocos project directory, also a newly created one, then it compiles all sources correctly, but stops trying to build an apk, with the message:

Can't find right android-platform for project : "/Applications/MAMP/htdocs/42words/frameworks/runtime-src/proj.android". The android-platform should be equal/larger than 10

The Env-Variables are set to:

ANDROID_SDK_ROOT=/Applications/adt-bundle-mac-x86_64-20140702 NDK_ROOT=/Applications/android-ndk-r10 ANT_ROOT=/usr/local/Cellar/ant/1.9.3/bin

And they are correct. At

/Applications/adt-bundle-mac-x86_64-20140702/sdk/platforms

there is a android-20 folder. If I call cocos with

cocos run -p android --ap 20

Then the message is

The directory "android-20" can't be found in android SDK

What am I missing?

Upvotes: 1

Views: 3394

Answers (3)

ninjahoahong
ninjahoahong

Reputation: 2664

To me, the problem can be solve by installing the older version of android sdk. Open your android ndk folder and check for the newest version of the NDK. If it is android-21 for example, then you open AndroidSDK Manager, and install AndroidSDK Build tools 21. After that, try again to run your project.

In addition, depend on your target device, you may also want to install an equivalent Android SDK platform.

Upvotes: 0

hassoncs
hassoncs

Reputation: 471

I had the same problem when I replaced my old copy of the Android SDK with the one from the Cocos Store.

Can't find right android-platform for project : "/Users/CurrentUser/ProjectName/frameworks/runtime-src/proj.android". The android-platform should be equal/larger than 16

Easy fix! Run android found at /android-sdk/tools/android and make sure that the Android version (in this case API 16) is downloaded.

Upvotes: 1

yangguang1029
yangguang1029

Reputation: 1823

here is my android_sdk_root, you lose /sdk?

export ANDROID_SDK_ROOT=/Project/adt-bundle-mac-x86_64-20131030/sdk

if not this reason, you can find this log in tools/cocos-console/plugins/project_compile/build_android.py

def check_android_platform(self, sdk_root, android_platform, proj_path, auto_select):

if you use python ,it's easy to find the reason by log

Upvotes: 0

Related Questions