i want to add fresco to my project so according to official site i put
compile 'com.facebook.fresco:fresco:0.9.0+'
into my gradle file. but after running the apk it fails on UnsatisfiedLinkError. i looked into my .apk and there is no /lib folder that should contain its .so files. i found out on the internet that gradle doesn't support .so files but i have seen projects that got it actually working, so there must be a way.
thanks in advance
Related
I was earlier using a native library whose .so file was kept in the jniLibs folder. I then decided to remove the library. So I deleted the jniLibs folder and all the references in the code that were pointing to the library.
I removed the abiFilters block from my app module's build.gradle as well.
Moreover, I have tried cleaning and rebuilding the project. I also explored other StackOverflow answers but all of them provide steps to be taken if a native library IS being used.
My Android Studio version is 3.1.2.
Any help will be appreciated, thanks!
Hey I'm pretty new to android studio, and relatively new to android development and it recently occurred to me that I'm not sure whether to put libraries in the libs folder or set them up as as an external library - what's the difference?
Most of what I've found online explains how to include jar files in the libs folder and then compile in the app gradle. This is what I've tended to do, but I've seen projects that work differently and I'm wondering what the protocol is for this.
Also how do you make an external library? Do you just place the jar file in it?
Thanks!
There is no way to create an external library directly in Android Studio. You add a library to your libs folder or add a dependency to your build.gradle, then you reimport the project, and it appears as an external library.
In other words, there is no difference - it's the same thing.
I've been trying to solve a problem about Android build, but couldn't figure out how to solve it.
Basically, I am trying to build an Android project using Gradle. It works perfect, but the size of the final apk is 7MB more than when I builded with Eclipse.
When I unzip the apk, I see that the JNI Libs are included twice. Which is different from the Eclipse build that includes it only one time. Here is the paths I can find them in the APK:
lib/armeabi
lib/armeabi-v7a
main/jniLibs/armeabi
main/jniLibs/armeabi-v7a
In my project, those two files are in:
android/app/src/main/jniLibs/armeabi
android/app/src/main/jniLibs/armeabi-v7a
I have two different build.graddle files in:
android/
android/app/
None of them contains anything related to the JNI Libs.
To build a release, I use the command:
./gradlew assembleRelease
And everything works fine. I use Gradle 1.10.
I was wondering if someone ever encountered the problem and find a solution to avoid to the JNI Libs to be included twice in the APK.
Thanks :)
Put .so files in...
/src/main/jniLibs/armeabi-v7a
/src/main/jniLibs/x86
directories and gradle will correctly package the .so files into the correct app and it won't include the duplicates
This is a good reference..
http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/
How do I build a JAR file from an Android Studio project? I've followed a lot of guides without much success. I tried compiling as a regular and library project but no JAR file get automatically generated. Do I have to do it manually or resort to Ant to get the Jar file?
Android Studio will compile your library into an AAR not a JAR. AARs are a little different since we rely on the SDK rather than a JAR to give use the Android API.
You will find the AAR under LibraryName/build/libs/LibraryName.aar.
I have spent days at this point compiling and re-compiling different versions of OpenCV to be used in Android apps.
I don't get any compiler errors, and I'm following all the steps in the tutorials.
But no .so files are getting generated and being placed in the /lib folder
Any ideas?
Do you work with eclipse? Which /lib folder do you mean?
the android/android-opencv/libs folder or
a specific folder from the included samples e.g. android/apps/CVCamera/libs folder?
Did you build OpenCV AND android-opencv AND the specific project without errors? You should check this first.
For a first shot I would suggest you to build a project from the included samples (e.g. the "CVCamera" project). In my folder structure it looked like this:
$cd somepath/OpenCV-2.3.0/android/apps/CVCamera
$sh project_create.sh
$ant compile
If this does not work then follow the error messages or post them here. Perhaps I can help you.
Good luck,
gartenabfall