-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Android 10 #361
base: master
Are you sure you want to change the base?
Conversation
Hi @1nikolas, Thanks you for coming out with an approach to fix it. I came across this issue today and saw your PR. I felt that this would work and this should've worked. But I am getting following error when I try this with Android 10:
I tried it on an Emulator running Android 10. After researching, it seems that FFMpeg and Google both have refused to fix this Text relocations issue. I just forked the library from your repo and imported it. Then gave a try. Am I doing something wrong? Also, before it used to work on Android < 10. But now it's throwing the error in those versions as well:
Looking forward to your response. |
The emulator uses by default x86 architecture and it doesnt work on x86 on Android 6+ that way (as I already mentioned). As for the other error, you have to add these on your app build.gradle (so it forces arm64 devices to use the arm binary and x86_64 to use the x86 one)
|
how can we use the new commit?? |
You can find the fork on my account or you can click |
@1nikolas Thanks for the quick reply. I tried your suggestion and it worked for Android < 10. But when I tested it on Android 10, it gave me a long error (couldn't see full error). I know that to resolve the issue, I should provide that error but there came some fault in the device and I am fixing it. As soon as it goes up, I will post the trace here. Thank you for the time. |
@1nikolas what did u mean by ffmpeg binary ? |
Pre build ffmpeg executables for each cpu architecture. This libary uses those to run ffmpeg (on the current commit its on the assets folder and on my commit its on the libs folder) |
this fix will be released ? or i have to pull from @1nikolas repository |
I don't think so. This repo is abandoned since 2016.. |
Its working fine but unable to upload app on play store |
Okay this is a problem I didn't predict. A workaround for this would be to keep the abifilters as you mentioned and copy libffmpeg.so from libs/x86 to libs/x86_64 and libffmpeg.so from libs/arm to libs/arm64. But this will make the apk size larger as it would have the library 4 times inside the apk. Anyway to everyone reading this, this PR is a workaround and doesnt work 100% because this library is super old. Just use a newer ffmpeg library (which uses ndk) instead of trying to fix this one. Its not worth the time. |
@1nikolas Can you recommend a "newer ffmpeg library"? For some strange reason, I still can't get hold of my Android 10 phone. I will be looking to implement your fix otherwise I might go for a newer library. |
There are many libs but this seems to be the most popular. You can google "ffmpeg android github" to find more . |
@1nikolas Well, thank you. I migrated to that library's LTS support (for which min SDK is 21) and it's working perfectly on Android 10. Thank you! 🎉 |
When I'm applied your code into my project, then I run project always recieved error: "ava.io.IOException: Cannot run program "/data/app/com.abc.xxx-eFkeAFz_FIOZAFRtph32mw==/lib/arm/libffmpeg.so": error=2, No such file or directory"? |
@HungTDO check this #361 (comment) |
It's worked! Thanks so much! |
Can you explain how did you do that ? |
@Ahmed715 Just go to this repo. Find the gradle dependency to add. Just remember you need to use |
How to switch between android Q version and below? Thank. I'm read file from libs folder but not working |
My fix should work in all android versions. Whats the error? |
Hi, @1nikolas Can you show me what the folders look like after copying? It's unable to load binary. It's always failing |
@godhiepnt they way you did it, it should work. Whats the error? The file isn't copied in the app data libs? |
Yes. If in buildTypes , abiFilters "armeabi-v7a", "x86" it works great . But abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' error : Can you help me understand better? |
@godhiepnt try using these two abi filters only |
This release is not compliant with the Google Play 64-bit requirement. @1nikolas Can you help me fix it? |
@godhiepnt you have to copy contents of arm to arm64 and cotents of x86 to x86_64. And then you have to modify some code (on FileUtils.java line 59 you have to add 2 more else ifs according on how arch folders are named) |
solution work in debug mode , but when we generate sign apk ,through as error #360 java.io.IOException: Cannot run program "/data/app/com.test.maker--dN1llxm8vYjyFIC4I3iHA==/lib//libffmpeg.so": error=2, No such file or directory |
If you use |
is there any solution for arm64-v8a x86_64 because when we fetch ffmpeg from lib folder it wont detect .so file, Through file not exist error. |
did you add those?
|
Yes added it work fine with that. but using this it exclude arm64-v8a x86_64 , so there is no 64 bit arch. according to new google play policy apps published on Google Play will need to support 64-bit architectures |
Okay then remove these I mentioned and copy x86 files in the x86_64 folder and arm files to arm64 folder (I dont remember the exact folder names) |
I did .but show the same issue |
@krushnarathod are you sure you used the correct folder names? |
Yes ,folder name is correct |
@krushnarathod try mobile-ffmpeg lts version. I don't know how to fix your problem |
// return context.getPackageResourcePath().replaceAll("/([^/]+)$", "/lib/") + archFolder + "/" + ffmpegFileName; Changed in FileUtils.java class and it works |
Thanks for modifying this. By the way , How to add your commit in build,gradle like implementation 'com.github.1nikolas:ffmpeg-android-java:master-SNAPSHOT' is this correct? Another question will it works on Android 11 and Upcoming android 12? |
@Udhayarajan Use this Library is very big, but you can generate that you need. And use apk split also.
|
@Udhayarajan you have to go to my profile, download my fork and import it manually to your project. But I haven't tested it with android 11 and 12. If you are going to upload your app on Playstore, just use mobile-ffmpeg with split apks. |
It works on Android 11 |
Hi, @1nikolas I still get below error while compiling this library.. java.io.IOException: Cannot run program "/data/app/com.test.maker--dN1llxm8vYjyFIC4I3iHA==/lib//libffmpeg.so": error=2, No such file or directory |
What Android are you on? It's only tested on Android 10. Also did you add |
Already add android:extractNativeLibs = "true" in the manifest |
@pintudhameliya123 try disabling offline gradle build and rebuild project. Also try https://github.com/tanersener/mobile-ffmpeg It is working on Android 11 also tested |
I got this error when writing ffmpeg from assets to lib on android 10. Is anyone showing me the solution. |
Yes it is working but what about the size of ur app , mine is so large after i used this lib |
Yes mine too. 30MB to 75MB which is huge. Try to split apks based on abis or use AAB if use Google play store to publish |
Also it supports only android level 24 and above , is there any way to make it support lower versions also from 21 level |
@Ahmed-Basalib10 use LTS version btw, FFMPEG is archived use FFmpegKit instead. |
I need to add this library natively , how do I do that, can you please tell me the steps to add it in my application natively and run on android 11. |
Based on this post.
Moved ffmpeg binary to the libs folder and added
android:extractNativeLibs = "true"
to the manifest so it can copy itself into/data/app/{package_name}/lib/{arch}/
and then execute it from there (which is supported on Android 10).The x86 binary doesn't work on Android 6+, and that's a separate bug (see here and here)
Fixes #343
Fixes #355
Fixes #360