执行应用程序异常
找不到符号" ANativeWindow_fromSurfaceTexture"由
引用System.loadLibrary("aaa");
在aaa.so文件中使用了ANativeWindow_fromSurfaceTexture函数(错误)
但使用ANativeWindow_fromSurface功能(没问题)
我找到了Android \ Sdk \ ndk-bundle \ sysroot \ usr \ include \ android \ native_window_jni.h
#if __ANDROID_API__ >= 13
/**
* Return the ANativeWindow associated with a Java SurfaceTexture object,
* for interacting with it through native code. This acquires a reference
* on the ANativeWindow that is returned; be sure to use ANativeWindow_release()
* when done with it so that it doesn't leak.
*/
ANativeWindow* ANativeWindow_fromSurfaceTexture(JNIEnv* env, jobject surfaceTexture);
#endif
我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "test.com.trytryNdk"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk{
ldLibs "log", "z", "m", "OpenMAXAL", "android"
}
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
jni.srcDirs = []
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}