Android Studio: Native build fails after and upgrade

Android Studio: Native build fails after and upgrade

Hi all. I just foolishly upgraded Android Studio and gradle, and now I cannot build my game. The error message is:

Build command failed.
Error while executing process /home/pfedor/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/pfedor/hervor/Hervor/ NDK_APPLICATION_MK=/home/pfedor/hervor/Hervor/ APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/home/pfedor/hervor/Hervor/ NDK_LIBS_OUT=/home/pfedor/hervor/Hervor/ NDK_TOOLCHAIN_VERSION=clang -j8 NDK_MODULE_PATH=/home/pfedor/hervor/Hervor/cocos2d:/home/pfedor/hervor/Hervor/cocos2d/cocos:/home/pfedor/hervor/Hervor/cocos2d/external NDK_DEBUG=1 MyGame}

make: *** No rule to make target `MyGame'.  Stop.

My file (which worked perfectly before the upgrade):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := MyGame_shared


FILE_LIST := $(wildcard $(LOCAL_PATH)/../../../../source/*.cc)
SHAPES_CODEGEN := $(wildcard $(LOCAL_PATH)/../../../../shapes/codegen/*.cc)
LOCAL_SRC_FILES := $(LOCAL_PATH)/hellocpp/main.cpp \
                   $(LOCAL_PATH)/../../../Classes/AppDelegate.cpp \
                   $(LOCAL_PATH)/../../../Classes/HelloWorldScene.cpp \
                   $(FILE_LIST:$(LOCAL_PATH)/%=%) \

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes





$(call import-module, cocos)


(in /, I’m setting PROP_BUILD_TYPE=ndk-build)

The project is based off of the default cocos2d-x template. My Android Studio version now is 3.5, Android Gradle Plugin version 3.5.0, Gradle version 5.4.1.

I realize the way go to about it is going to be a lot of poking and trial and error, but posting this in the hope that someone has had the same problem. Thank you!


1 Like

From experience, that error is almost expected every time we upgrade Android Studio. First thing to try is to do a clean, then go into the folder, and manually delete all the generated build files. You can easily tell which ones they are if you compare it to a newly generated project.

If the error persists, enable more verbose output from the gradle build process, and it should help you track down the cause of the error.

I also tried updating Android Studio 3.5.
I tried to build the project cleanly,
The build will fail just like you.

I don’t want to spend time on this issue, so I’ll uninstall 3.5.
Download and install 3.4 from the archive.

I’m expirienced same troubles. Swithing to cmake instead of ndk-build solved compiling error. But yes, ndk-build dont work anymore after last android studio upgrade.

1 Like

No need downgrade android studio itself. Temporary solution is downgrade gradle plugin to 5.1.1

Go to build.gradle on your (or find line

dependencies {
        classpath ''

and change it to

dependencies {
        classpath ''

then go to gradle/wrapper find line


and change it to


Sync project and try build again.


Thanks, fix works great.

Thanks @CAPONE It’s worked for me.

I only now got the chance to try it out and I want to join in with the thanks–@CAPONE it worked for me too thank you!

you can just mark my reply as solution

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.