In the same environment, it can be compiled successfully on windows, but Ubuntu can't

Hi all,
I’m using gradlew compilation to generate APK. The version of gradle I use is 6.1.1 (the corresponding plug-in is version 4.1.1). I can successfully compile and generate APK under Windows environment, but I want to compile and generate APK under Ubuntu through the porting function of gradlew. After configuring the same NDK and cmake, I found that the compilation failed. The error log is as follows:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeReleaseNativeLibs’.

A failure occurred while executing$ActionFacade
More than one file was found with OS independent path ‘lib/armeabi-v7a/’. If you are using jniLibs and CMake IMPORTED targets, see New features in Android Studio Preview  |  Android Developers

After checking the update of gradle plug-in on the official website, I found that it was the problem of repeatedly packaging “.so” files. So I can compile successfully by configuring the path of jnilibs or by configuring “packaging options” under “app/build.gradle”. But this is not what I want. Because I compare it with APK under windows. Found a lot less “. so” files. So how can I get the same APK as windows?
This is a very difficult question for me because this is my first contact with gradle. But I need to configure such a Ubuntu environment to generate the corresponding APK. Please help me, thank you very much!