我正尝试将 Superpowered SDK 添加到我的Android项目中,我已经从官方网站下载了 .zip 文件,并将其复制到D盘中位置,我在 CMakeLists.txt 文件中设置位置路径,如下所示:
cmake_minimum_required(VERSION 3.4.1)
set(
PATH_TO_SUPERPOWERED
CACHE STRING ""
)
message(${ANDROID_ABI})
file(GLOB CPP_FILES "*.cpp")
add_library(
sp-lib
SHARED
${CPP_FILES}
D:/SuperpoweredSDK/SuperpoweredSDK/Superpowered/OpenSource/SuperpoweredAndroidAudioIO.cpp
)
include_directories(src/main/jni)
include_directories(${PATH_TO_SUPERPOWERED})
target_link_libraries(
sp-lib
log
android
OpenSLES
D:/SuperpoweredSDK/SuperpoweredSDK/Superpowered/libSuperpoweredAndroid${ANDROID_ABI}.a
)
这是完整的东西:
plugins { id 'com.android.application' }
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def superpowered_sdk_path = properties.getProperty('superpowered.dir')
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "maa.audioeditor"
minSdkVersion 18
targetSdkVersion 30
versionCode 1
versionName "1.0"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
arguments '-DANDROID_PLATFORM=android-16', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_ARM_NEON=TRUE', '-DANDROID_STL=gnustl_static', "-DPATH_TO_SUPERPOWERED:STRING=${superpowered_sdk_path}"
cFlags '-O3', '-fsigned-char'
cppFlags '-fsigned-char', "-I${superpowered_sdk_path}"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jni']
}
}
externalNativeBuild {
cmake {
path 'src/main/jni/CMakeLists.txt'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
testImplementation 'junit:junit:4.+'
implementation group: 'com.arthenica', name: 'mobile-ffmpeg-full', version: '4.4.LTS'
implementation 'com.google.android.exoplayer:exoplayer:2.11.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
当我尝试重建项目时,出现此错误消息:
A problem occurred evaluating project ':app'.
> No signature of method: build_erhbqg29at4ete0101fpngpli.android() is applicable for argument types: (build_erhbqg29at4ete0101fpngpli$_run_closure1) values: [build_erhbqg29at4ete0101fpngpli$_run_closure1@1d7938e1]