使用了
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})
但是在 對應的 main 里面 沒有生成 jniLibs
即使我手工生成 jinLibs 也沒有 輸出 檔案
cmakelist 如下
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
MyUdp
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
myudp.cpp
)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
MyUdp
# Links the target library to the log library
# included in the NDK.
${log-lib})
uj5u.com熱心網友回復:
我用3.4.1 根據配置SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/armeabi-v7a)可以生成,你cpp檔案不需要指定具體路徑嗎?uj5u.com熱心網友回復:
寫絕對路徑試試轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/9231.html
標籤:Android
上一篇:import androidx.core.content.edit 出現 unresolved reference: edit??
下一篇:控制臺報錯SyntaxError: Invalid regular expression: invalid group specifier name
