Cocos2d-x console gradle 3.0.1 compile issue

Hello, I updated gradle.build to use latest as Android Studio suggested gradle version 3.0.1 and gradle wrapper 4.1:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
}

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

When I run on clean project thru console compile :
cocos run -p android -j 4 --android-studio -m release

I get following error:

Execution failed for task ‘:MyCoolGame:externalNativeBuildRelease’.

java.io.FileNotFoundException: /Users/macbook/Documents/cocos_projects/MyCoolGame/proj.android-studio/app/.externalNativeBuild/ndkBuild/release/armeabi-v7a/android_gradle_build.json (No such file or directory)

@yinjimmy @nite @slackmoehrle
If before running console command I start project in android-studio - it caching some files and then console works. Is there some incompatibility for Latest Gradle version and Cocos2d-x compile console, could you please make it clear?

I would suggest to call in the folder /Users/macbook/Documents/cocos_projects/MyCoolGame/proj.android-studio/ the command ./gradlew clean build. Sometimes the gradle cache is broken after updating versions (or switching branches). After that your cocos console should run without problems, I hope.

for clean it could work, but as we using cloud compile it will be to long compile if we make clean before each build, so we need some command which we can run before every build to make sure we not face that error or maybe it should be fixed on cocos console level

Not everytime. Just once. The cocos command is not a magic one. It just calls ./gradlew assemble and this fails, so you need to clean the old build.

but I make already clean build, I deleting “build” folders and “.externalndkbuild” folders to make sure it fully recompiled and then by some reason cocos or gradle looking for that file: android_gradle_build.json inside not existing folder

If I make compile in android-studio it generating that file there and after I can run console

Is the single command ./gradlew assemble working or not, after you delete build/externalndkbuild (both within app)?

direct command seems to work, also as I’m changed build tools to 27.0.3 maybe there is incompability also in gradle files, because Im getting such warnings:

Configuration 'compile' in project ':libcocos2dx' is deprecated. Use 'implementation' instead.

This is just a warning and will be fixed in 3.17.

probably cocos console also will be fixed ;/ as now it is much easier to use it to generate proper apk