Skip to content
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

How can i export this application to aar library #5

Closed
matart15 opened this issue Oct 14, 2016 · 8 comments
Closed

How can i export this application to aar library #5

matart15 opened this issue Oct 14, 2016 · 8 comments

Comments

@matart15
Copy link

I want to use FFmpegRecordActivity from Nativescript.
For that I have to export application to aar library and call FFmpegRecordActivity class from javascript via Intent.

I did that part It worked.

But after FFmpegRecordActivity is displayed it breaks with this error.

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at org.bytedeco.javacpp.Loader.load(Loader.java:413)
at org.bytedeco.javacpp.Loader.load(Loader.java:381)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1650)

It seems not nativescript problem. Because same thing happened when i import aar from another android studio application.

camera, external storage permissions are given and on for application


I did the trick from bytedeco/javacv#133 : moved *.so files to "app/src/main/jniLibs/armeabi-v7a" and "app/src/main/jniLibs/armeabi" folders and it seems not working

@CrazyOrr
Copy link
Owner

CrazyOrr commented Oct 16, 2016

Can you run this application directly (not exported as aar library) on your testing device successfully without the "UnsatisfiedLinkError" you mention?

@matart15
Copy link
Author

Application run directly in my phone without problem.

I asked same question on JavaCpp repo.
bytedeco/javacpp-presets#303

It seems *.so file related. But i have no idea how to import them correctly.

@matart15
Copy link
Author

matart15 commented Oct 17, 2016

I am not very famillar with android and java development.

If you have time can you look into it. Please.

I am pulling all my hairs here

I created aar from matart15/FFmpegRecorder with ./gradlew assembleRelease.
then copied app/output/aar/app-release.aar into matart15/FFmpegRecorder_loader app/libs
(tried creating local maven but results were same.)

with this method simple library works.
library withour *.so -> app1 to create aar -> app2 that uses aar from app1

@matart15
Copy link
Author

I used this app to see copied libs.
https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app&hl=en
screenshot_20161017-121132

if this app working right then *.so files seems copied.

Is it possible that *.so files are copied and not being referenced?

@CrazyOrr
Copy link
Owner

The problem is this application currently not working on sdk version 23 or above. (See #3 )
When you import this application as aar library, the targetSdkVersion of the library, which is 22 (https://github.com/CrazyOrr/FFmpegRecorder/blob/master/app/build.gradle), gets overrided by your application's targetSdkVersion, which is 24 (https://github.com/matart15/FFmpegRecorder_loader/blob/master/app/build.gradle), hence the "UnsatisfiedLinkError" occurs. But when you run this application directly, the targetSdkVersion 22 is honored, so no error.

@matart15
Copy link
Author

matart15 commented Oct 18, 2016

Thank you It was sdk version. My app worked.

Looking forward to sdk 23 support.

@CrazyOrr
Copy link
Owner

You can checkout 'sdk-23-plus' branch to try it on SDK 23 or above now.

@matart15
Copy link
Author

Thank you I will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants