日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > Android >内容正文

Android

android如何编译lame,Android 编译 Lame 库心路历程

發(fā)布時(shí)間:2025/4/5 Android 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android如何编译lame,Android 编译 Lame 库心路历程 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

編譯腳本

lame 版本

下載完成后 編譯 生成

include

lib

兩個(gè)文件夾

直接拷貝到 lib 目錄下

集成

然后

CMakeList 里面添加頭文件路徑 不做這一步 后面無(wú)法在 C++文件里面include

include(libs/include/lame/lame.h)

更簡(jiǎn)單的 可以直接添加目錄

include_directories(libs/include)

添加靜態(tài)庫(kù)鏈接 這一步忘記了會(huì)導(dǎo)致編譯報(bào)錯(cuò)

add_library(mp3lame STATIC IMPORTED)

set_target_properties(mp3lame

PROPERTIES IMPORTED_LOCATION

${distribution_DIR}/armeabi-v7a/libmp3lame.a)

target_link_libraries( # Specifies the target library.

native-lib

mp3lame

# Links the target library to the log library

# included in the NDK.

${log-lib})

完整的 CMake

# 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)

set(distribution_DIR ../../../../libs)

include_directories(libs/include)

# 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.

native-lib

# Sets the library as a shared library.

SHARED

# Provides a relative path to your source file(s).

src/main/cpp/native-lib.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)

# 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.

native-lib

mp3lame

# Links the target library to the log library

# included in the NDK.

${log-lib})

add_library(mp3lame STATIC IMPORTED)

set_target_properties(mp3lame

PROPERTIES IMPORTED_LOCATION

${distribution_DIR}/armeabi-v7a/libmp3lame.a)

CMake編譯

needed by錯(cuò)誤

一定是路徑設(shè)置不對(duì)

.a文件呢或者.so文件設(shè)置不對(duì)

總結(jié)出,NDK 中引入別的庫(kù)

下載庫(kù) 交叉編譯庫(kù) .a .so 不一定要編譯,也可以源碼代入

導(dǎo)入 AndroidStudio,編寫(xiě) CMake,導(dǎo)入頭文件

編譯相關(guān)源代碼

build 出相應(yīng)的 so

參考

總結(jié)

以上是生活随笔為你收集整理的android如何编译lame,Android 编译 Lame 库心路历程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。