gpt4 book ai didi

java.lang.UnsatisfiedLinkError : No implementation found (When Implement a SDK)

转载 作者:行者123 更新时间:2023-12-04 03:47:36 34 4
gpt4 key购买 nike

我正在尝试集成第三方 SDK (DeepAR)。但是当我构建它时,它会显示一个错误。我试图修复它。如果我创建一个简单的新项目,它就可以正常工作。但是我现有的应用程序我使用相机和 ndk。请帮我找出错误。
这是 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.
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

# Links the target library to the log library
# included in the NDK.
${log-lib})
Activity 课
public class DeeparActivity extends AppCompatActivity implements AREventListener {

private CameraGrabber cameraGrabber;
private int defaultCameraDevice = Camera.CameraInfo.CAMERA_FACING_FRONT;
private int cameraDevice = defaultCameraDevice;
private DeepAR deepAR;
private int currentMask = 0;
private int currentEffect = 0;
private int currentFilter = 0;
private int screenOrientation;
ArrayList<String> masks;
ArrayList<String> effects;
ArrayList<String> filters;
private int activeFilterType = 0;
private boolean recording = false;
private boolean currentSwitchRecording = false;
private String recordingPath = Environment.getExternalStorageDirectory() + File.separator + "video.mp4";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deepar);

deepAR = new DeepAR(this);
deepAR.setLicenseKey("foobarbaz");
deepAR.initialize(this, this);
setupCamera();

}
private void setupCamera() {
cameraGrabber = new CameraGrabber(cameraDevice);
screenOrientation = getScreenOrientation();

switch (screenOrientation) {
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
cameraGrabber.setScreenOrientation(90);
break;
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
cameraGrabber.setScreenOrientation(270);
break;
default:
cameraGrabber.setScreenOrientation(0);
break;
}

// Available 1080p, 720p and 480p resolutions
cameraGrabber.setResolutionPreset(CameraResolutionPreset.P1280x720);

final Activity context = this;
cameraGrabber.initCamera(new CameraGrabberListener() {
@Override
public void onCameraInitialized() {
cameraGrabber.setFrameReceiver(deepAR);
cameraGrabber.startPreview();
}

@Override
public void onCameraError(String errorMsg) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Camera error");
builder.setMessage(errorMsg);
builder.setCancelable(true);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
}
}
下面给出了确切的错误
2020-11-20 00:17:37.274 7565-7728/com.songsterbd.songster E/IJKMEDIA: Option ijkiomanager not found.
2020-11-20 00:17:39.691 7565-7565/com.songsterbd.songster E/sterbd.songste: No implementation found for void ai.deepar.ar.DeepAR.setLicenseKeyN(java.lang.String) (tried Java_ai_deepar_ar_DeepAR_setLicenseKeyN and Java_ai_deepar_ar_DeepAR_setLicenseKeyN__Ljava_lang_String_2)
2020-11-20 00:17:39.692 7565-7565/com.songsterbd.songster E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.songsterbd.songster, PID: 7565
java.lang.UnsatisfiedLinkError: No implementation found for void ai.deepar.ar.DeepAR.setLicenseKeyN(java.lang.String) (tried Java_ai_deepar_ar_DeepAR_setLicenseKeyN and Java_ai_deepar_ar_DeepAR_setLicenseKeyN__Ljava_lang_String_2)
at ai.deepar.ar.DeepAR.setLicenseKeyN(Native Method)
at ai.deepar.ar.DeepAR.setLicenseKey(DeepAR.java:223)
at com.songsterbd.songster.view.activity.DeeparActivity.initializeDeepAR(DeeparActivity.java:363)
at com.songsterbd.songster.view.activity.DeeparActivity.initialize(DeeparActivity.java:105)
at com.songsterbd.songster.view.activity.DeeparActivity.onCreate(DeeparActivity.java:79)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
我试图修复它。如果需要更多信息,请告诉我。我感谢你。谢谢

最佳答案

一周后,我找到了解决方案。它会与图书馆产生冲突。我将 CMakeLists 文件更改为新文件,然后删除冲突。
现在工作的 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.
cpp-cla

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
src/main/cpp/cpp-cla.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.
cpp-cla

# Links the target library to the log library
# included in the NDK.
${log-lib})

关于java.lang.UnsatisfiedLinkError : No implementation found (When Implement a SDK),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64917805/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com