android导入老项目出现的问题和解决办法

1、运行项目出现下列错误

Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
 https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
 https://developer.android.com/r/tools/experimental-plugin.html
 

 

在module下的build.gradle android标签内添加

externalNativeBuild {
    ndkBuild {
        path 'src/main/jni/Android.mk'
    }
}

2、More than one file was found with OS independent path 'lib/armeabi-v7a/libffmpeg.so'

当运行项目时出现下面的错误

packagingOptions { //打包时的相关配置
    pickFirst 'lib/armeabi-v7a/libffmpeg.so'
    pickFirst 'lib/armeabi-v7a/libfaac.so'
...
}

 

你可能感兴趣的:(android,jni,编译,gradle)