The problem of high version Gradle loading so file

Recently I needed to do a project about face recognition, and I encountered a problem of loading the so file. Record it here.

Low version gradle
https://services.gradle.org/distributions/gradle-4.4-all.zip
com.android.tools.build:gradle:3.1.2

High version gradle
https://services.gradle.org/distributions/gradle-6.1.1-all.zip
com.android.tools.build:gradle:4.0.1

Let me talk about the phenomenon of
adding a high-aar file version project libs in
and joined in the app.gradle

 repositories{
    
    
        flatDir{
    
    
            dirs 'libs'
        }
    }
dependencies {
    
    
    implementation(name: 'sdk', ext: 'aar')
}

sdk. to 中
jni file in aar

public class MainActivity extends AppCompatActivity {
    
    
    static {
    
    
        System.loadLibrary("xxx");
    }
}

After starting the application, an error was reported, saying that the libxxx.so file could not be found, and I looked confused.
It can run normally on a colleague's computer. Later, I took his project and looked at it and compared it. The code was exactly the same. The only difference is the gradle version. I just tried it.
Hey! It's really normal.

Because the architecture in the aar file is armeabi-v7a. So add in app.gradle

ndk{
    
    
            abiFilters'armeabi-v7a'
        }

Can

Guess you like

Origin blog.csdn.net/adminyuqiao/article/details/108625257