欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android开发之AndroidStudio兼容第三方库和自定义库

程序员文章站 2022-06-23 12:30:29
1.在CMakeList.txt中设置自定义库的加载路径,不要和第三方库的路径一致,否则每次编译都会删掉第三方库CMakeList.txt:......set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/jniLibs/${ANDROID_ABI})......2.在模块的build.gradle中设置第三方库的加载路径:android {...... defaultConfig { .........

1.在CMakeLists.txt中设置自定义库的加载路径,不要和第三方库的路径一致,否则每次编译都会删掉第三方库
CMakeList.txt:

......
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/jniLibs/${ANDROID_ABI})
......

2.在模块的build.gradle中设置第三方库的加载路径:

android {
......
	    defaultConfig {
	    ......
	    	ndk {
           		// Specifies the ABI configurations of your native
            	// libraries Gradle should build and package with your APK.
            	abiFilters 'armeabi-v7a','arm64-v8a'
        	}
        	sourceSets.main.jniLibs.srcDirs = ['libs']
	    ......
		}
......
}

本文地址:https://blog.csdn.net/qq_33750826/article/details/107518573