Closed kigkrazy closed 6 years ago
maybe some error is important
--------- beginning of crash
11-06 00:36:23.009 8808-8880/? E/AndroidRuntime: FATAL EXCEPTION: Thread-507
Process: org.bytedeco.javacv.android.recognize.example, PID: 8808
java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at org.bytedeco.javacv.FFmpegFrameFilter.startUnsafe(FFmpegFrameFilter.java:159)
at org.bytedeco.javacv.FFmpegFrameFilter.start(FFmpegFrameFilter.java:155)
at org.bytedeco.javacv.android.recognize.example.CvCameraPreview$CameraWorker.run(CvCameraPreview.java:782)
at java.lang.Thread.run(Thread.java:818)
Please try again with JavaCV 1.4.3.
I try something from The UnsatisfiedLinkError X File (a real experience)
add something in MainActivity
but it did not work.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preloadLibraries();
findViewById(R.id.btnOpenCv).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mPermissionReady) {
startActivity(new Intent(MainActivity.this, OpenCvRecognizeActivity.class));
}
}
});
int cameraPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
int storagePermssion = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
mPermissionReady = cameraPermission == PackageManager.PERMISSION_GRANTED
&& storagePermssion == PackageManager.PERMISSION_GRANTED;
if (!mPermissionReady)
requirePermissions();
}
public void preloadLibraries(){
// URL[] emptyUrls = new URL[0];
// Loader.loadLibrary(emptyUrls, "opencv_core");
// Loader.loadLibrary(emptyUrls, "opencv_imgproc");
ReLinker.Logger logger = message -> Log.v("HODOR", "(hold the door) " + message);
ReLinker.log(logger).recursively().loadLibrary(this, "jniopencv_core");
ReLinker.log(logger).recursively().loadLibrary(this, "opencv_core");
ReLinker.log(logger).recursively().loadLibrary(this, "jniopencv_imgcodecs");
ReLinker.log(logger).recursively().loadLibrary(this, "opencv_imgcodecs");
ReLinker.log(logger).recursively().loadLibrary(this, "jniopencv_imgproc");
ReLinker.log(logger).recursively().loadLibrary(this, "opencv_imgproc");
}
Is there has some error in my code?
That should be fixed with JavaCV 1.4.3. Let me know if you still have problems after upgrading though, thanks!
update the depencies
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.getkeepsafe.relinker:relinker:1.3.0'
compile group: 'org.bytedeco', name: 'javacv', version: '1.4.3'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.0.2-1.4.3', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.0.2-1.4.3', classifier: 'android-x86'
}
but get some error in example
I think the example should be update!!!!!
Yes, it needs to be updated like in commit https://github.com/bytedeco/javacv/commit/2836f78fd1656af83739b5e816fe6398fc78add9. Contributions are welcome!
Thank U, I push a PR to sample-projects
, U can check it.
the test demo is javacv-android-recognize.
the environment is below
Nexus5
I'm sorry,I see some problem,but I don't understant solved it.
get an crash