Android depends on arr package gradle7.0

Today, the company wants to integrate a third-party library of the arr package. The demo is normal (gradle6.7), but it cannot be relied on when it is put into the project (gradle7.0.3) Could not find :nfc_wm_1.0:. Required by: project :app Search in build.gradle files. .arr is different from the previous version.

  • The arr package is placed in the libs directory
  • A dynamic library is placed in the main/jniLibs directory corresponding to the cpu architecture folder, and one is created without jniLibs. 1
Before Gradle7.0

1. Add the following content to the android{} node of the project app directory build.gradle file.

android {
    
    
	repositories {
    
    
        	flatDir {
    
    
            	dirs 'libs'
        	}
    	}
    }

2. Add the following content to the project app directory build.gradle file dependencies

dependencies {
    
    
	implementation(name: 'nfc_wm_1.0', ext: 'aar')
}

3. Make Project and compile the project, you will see that arr can rely normally
insert image description here

Gradle7.0 and later

implementation files('') Currently testing gradle6-7 can be used, the lower version is yet to be tested

1. Add the following content directly to the project app directory build.gradle file dependencies

dependencies {
    
    
	implementation files('libs/nfc_wm_1.0.aar')
}

2. Make Project and compile the project, you will see that arr can rely normally
insert image description here

aar package and .so dynamic library location

insert image description here

The above method still can't solve your problem, you can see the official document and compare the specific differences .

https://developer.android.com/studio/projects/android-library
may require a ladder to open the link


  1. ↩︎

Guess you like

Origin blog.csdn.net/qq_35193677/article/details/124343910
Arr