I am trying out to integrate a third-party SDK (DeepAR). But when I build it, that time it shows an error. I tried to fix it. If I create a simple new project it's working properly. But my existing apps I use camera and ndk. Please help me to find out the error.
Here is the C file.
#include <jni.h>
#include <string>
extern "C" JNIEXPORT jstring JNICALL
Java_com_songsterbd_songster_utils_MyConstants_baseUrlFromJNI(JNIEnv *env, jclass clazz) {
std::string mUrl = "aHR0cHM6Ly9hcGkuc29uZ3N0ZXIuaW5mby8=";
return env->NewStringUTF(mUrl.c_str());
}
extern "C" JNIEXPORT jstring JNICALL
Java_com_songsterbd_songster_utils_MyConstants_logBaseUrlFromJNI(JNIEnv *env, jclass clazz) {
std::string hello = "aHR0cDovLzIwMi4xNjQuMjEzLjI0Mg==";
return env->NewStringUTF(hello.c_str());
}
Activity class
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();
}
});
}
}
The exact error is given below
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)
I tried to fix it. Do let me know if any more information is needed. I am grateful to you. Thanks
from java.lang.UnsatisfiedLinkError: No implementation found (When Implement a SDK)
No comments:
Post a Comment