Integrating FFMPEG using cmake: dlopen failed: library “libavutil.so.56” not found
This question is a subsequent thread following this other question of mine.
After finally managing to successfully building the apk file using gradle and cmake to integrate FFMPEG into an Android project I am facing a new exception which is thrown when calling System.loadLibrary
.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libavutil.so.56" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.hmomeni.canto.activities.EditActivity.<init>(EditActivity.kt:26)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This is the part of code which is causing the error:
class EditActivity : AppCompatActivity(), View.OnClickListener {
init {
System.loadLibrary("Canto")
}
...
}
I tried moving the .so
files inside the PROJECT/app/jniLibs
and then adding the following line to build.gradle
file to no avail.
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
android ffmpeg cmake android-ndk linker
add a comment |
This question is a subsequent thread following this other question of mine.
After finally managing to successfully building the apk file using gradle and cmake to integrate FFMPEG into an Android project I am facing a new exception which is thrown when calling System.loadLibrary
.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libavutil.so.56" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.hmomeni.canto.activities.EditActivity.<init>(EditActivity.kt:26)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This is the part of code which is causing the error:
class EditActivity : AppCompatActivity(), View.OnClickListener {
init {
System.loadLibrary("Canto")
}
...
}
I tried moving the .so
files inside the PROJECT/app/jniLibs
and then adding the following line to build.gradle
file to no avail.
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
android ffmpeg cmake android-ndk linker
what is your directory content inside/jniLibs/
?
– shizhen
Nov 22 '18 at 2:13
@shizhen, sorry I'm replying this late. It'sapp/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.
– Hamed Momeni
Nov 25 '18 at 6:36
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29
add a comment |
This question is a subsequent thread following this other question of mine.
After finally managing to successfully building the apk file using gradle and cmake to integrate FFMPEG into an Android project I am facing a new exception which is thrown when calling System.loadLibrary
.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libavutil.so.56" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.hmomeni.canto.activities.EditActivity.<init>(EditActivity.kt:26)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This is the part of code which is causing the error:
class EditActivity : AppCompatActivity(), View.OnClickListener {
init {
System.loadLibrary("Canto")
}
...
}
I tried moving the .so
files inside the PROJECT/app/jniLibs
and then adding the following line to build.gradle
file to no avail.
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
android ffmpeg cmake android-ndk linker
This question is a subsequent thread following this other question of mine.
After finally managing to successfully building the apk file using gradle and cmake to integrate FFMPEG into an Android project I am facing a new exception which is thrown when calling System.loadLibrary
.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libavutil.so.56" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.hmomeni.canto.activities.EditActivity.<init>(EditActivity.kt:26)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This is the part of code which is causing the error:
class EditActivity : AppCompatActivity(), View.OnClickListener {
init {
System.loadLibrary("Canto")
}
...
}
I tried moving the .so
files inside the PROJECT/app/jniLibs
and then adding the following line to build.gradle
file to no avail.
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
android ffmpeg cmake android-ndk linker
android ffmpeg cmake android-ndk linker
edited Nov 25 '18 at 7:39
shizhen
2,7373730
2,7373730
asked Nov 21 '18 at 19:39
Hamed MomeniHamed Momeni
4,00864787
4,00864787
what is your directory content inside/jniLibs/
?
– shizhen
Nov 22 '18 at 2:13
@shizhen, sorry I'm replying this late. It'sapp/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.
– Hamed Momeni
Nov 25 '18 at 6:36
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29
add a comment |
what is your directory content inside/jniLibs/
?
– shizhen
Nov 22 '18 at 2:13
@shizhen, sorry I'm replying this late. It'sapp/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.
– Hamed Momeni
Nov 25 '18 at 6:36
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29
what is your directory content inside
/jniLibs/
?– shizhen
Nov 22 '18 at 2:13
what is your directory content inside
/jniLibs/
?– shizhen
Nov 22 '18 at 2:13
@shizhen, sorry I'm replying this late. It's
app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.– Hamed Momeni
Nov 25 '18 at 6:36
@shizhen, sorry I'm replying this late. It's
app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.– Hamed Momeni
Nov 25 '18 at 6:36
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29
add a comment |
1 Answer
1
active
oldest
votes
If you configure your jniLibs.srcDirs as below:
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
Then your path app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
is not correct and your .so
files won't be found and packaged by your build system.
Try to make your jniLibs structure be as below:
jniLibs
│ ├── x86
│ ├── x86_64
│ ├── arm64-v8a
│ ├── armeabi-v7a
Dont add lib
behind {ANDROID_ABI}/
.
---Edit---
And after manually loading the libraries using System.loadLibrary I encountered a new error which indicates that libavutil has text relocations and it seems that for API-23 and above it is not permitted.
Maybe you should try to build your ffmpeg with option --disable-asm
and -fPIC
to have a binary without text relocation. See here https://stackoverflow.com/a/39965908/8034839, but it looks there still some issue with NEON.
Another discussion for your information:
https://stackoverflow.com/a/50207091/8034839
I changed the directory structure toapp/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.
– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419416%2fintegrating-ffmpeg-using-cmake-dlopen-failed-library-libavutil-so-56-not-fou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you configure your jniLibs.srcDirs as below:
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
Then your path app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
is not correct and your .so
files won't be found and packaged by your build system.
Try to make your jniLibs structure be as below:
jniLibs
│ ├── x86
│ ├── x86_64
│ ├── arm64-v8a
│ ├── armeabi-v7a
Dont add lib
behind {ANDROID_ABI}/
.
---Edit---
And after manually loading the libraries using System.loadLibrary I encountered a new error which indicates that libavutil has text relocations and it seems that for API-23 and above it is not permitted.
Maybe you should try to build your ffmpeg with option --disable-asm
and -fPIC
to have a binary without text relocation. See here https://stackoverflow.com/a/39965908/8034839, but it looks there still some issue with NEON.
Another discussion for your information:
https://stackoverflow.com/a/50207091/8034839
I changed the directory structure toapp/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.
– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
|
show 3 more comments
If you configure your jniLibs.srcDirs as below:
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
Then your path app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
is not correct and your .so
files won't be found and packaged by your build system.
Try to make your jniLibs structure be as below:
jniLibs
│ ├── x86
│ ├── x86_64
│ ├── arm64-v8a
│ ├── armeabi-v7a
Dont add lib
behind {ANDROID_ABI}/
.
---Edit---
And after manually loading the libraries using System.loadLibrary I encountered a new error which indicates that libavutil has text relocations and it seems that for API-23 and above it is not permitted.
Maybe you should try to build your ffmpeg with option --disable-asm
and -fPIC
to have a binary without text relocation. See here https://stackoverflow.com/a/39965908/8034839, but it looks there still some issue with NEON.
Another discussion for your information:
https://stackoverflow.com/a/50207091/8034839
I changed the directory structure toapp/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.
– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
|
show 3 more comments
If you configure your jniLibs.srcDirs as below:
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
Then your path app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
is not correct and your .so
files won't be found and packaged by your build system.
Try to make your jniLibs structure be as below:
jniLibs
│ ├── x86
│ ├── x86_64
│ ├── arm64-v8a
│ ├── armeabi-v7a
Dont add lib
behind {ANDROID_ABI}/
.
---Edit---
And after manually loading the libraries using System.loadLibrary I encountered a new error which indicates that libavutil has text relocations and it seems that for API-23 and above it is not permitted.
Maybe you should try to build your ffmpeg with option --disable-asm
and -fPIC
to have a binary without text relocation. See here https://stackoverflow.com/a/39965908/8034839, but it looks there still some issue with NEON.
Another discussion for your information:
https://stackoverflow.com/a/50207091/8034839
If you configure your jniLibs.srcDirs as below:
sourceSets.main.jniLibs.srcDirs = ['./jniLibs/']
Then your path app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
is not correct and your .so
files won't be found and packaged by your build system.
Try to make your jniLibs structure be as below:
jniLibs
│ ├── x86
│ ├── x86_64
│ ├── arm64-v8a
│ ├── armeabi-v7a
Dont add lib
behind {ANDROID_ABI}/
.
---Edit---
And after manually loading the libraries using System.loadLibrary I encountered a new error which indicates that libavutil has text relocations and it seems that for API-23 and above it is not permitted.
Maybe you should try to build your ffmpeg with option --disable-asm
and -fPIC
to have a binary without text relocation. See here https://stackoverflow.com/a/39965908/8034839, but it looks there still some issue with NEON.
Another discussion for your information:
https://stackoverflow.com/a/50207091/8034839
edited Nov 26 '18 at 1:52
answered Nov 25 '18 at 7:37
shizhenshizhen
2,7373730
2,7373730
I changed the directory structure toapp/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.
– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
|
show 3 more comments
I changed the directory structure toapp/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.
– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
I changed the directory structure to
app/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.– Hamed Momeni
Nov 25 '18 at 8:06
I changed the directory structure to
app/jniLibs/{ANDROID_ABI}/libavutil.so.56
but I'm still getting the same result. The library can not be found.– Hamed Momeni
Nov 25 '18 at 8:06
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Remove “.56” from your lib name
– shizhen
Nov 25 '18 at 8:54
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Actually all versions of the file names are present in the directory. Check this image to see for yourself. imgur.com/a/j7s6Eka
– Hamed Momeni
Nov 25 '18 at 9:01
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Have you analyzed your apk? Try to check whether your .so are packaged inside. I am using mobile, please forgive my brievity of reply.
– shizhen
Nov 25 '18 at 9:03
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
Probably you need to explicitly load all the.so from init{} just like “Canto”
– shizhen
Nov 25 '18 at 9:07
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419416%2fintegrating-ffmpeg-using-cmake-dlopen-failed-library-libavutil-so-56-not-fou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what is your directory content inside
/jniLibs/
?– shizhen
Nov 22 '18 at 2:13
@shizhen, sorry I'm replying this late. It's
app/jniLibs/ffmpeg/{ANDROID_ABI}/lib
.– Hamed Momeni
Nov 25 '18 at 6:36
Your jniLibs.srcDirs should include the path till the level of directory ffmpeg and remove /lib.
– shizhen
Nov 25 '18 at 7:29