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

Reduce APK size with different ABI #14

Closed
MarcorOnline opened this issue Mar 24, 2017 · 4 comments
Closed

Reduce APK size with different ABI #14

MarcorOnline opened this issue Mar 24, 2017 · 4 comments
Assignees

Comments

@MarcorOnline
Copy link

MarcorOnline commented Mar 24, 2017

Hello.

I'm using this issue to suggest the following procedure to produce small specific ABI apks in a very easy way:

  • Compile the OpenCV.Android.Binding with the "None" profile. It will be about 1 MB and reference this DLL in the app Android project.

  • Create a "lib" folder in the app Android project and copy inside it the content of your "Jars" folder ("opencv-3.1.0.zip", "armeabi", "armeabi-v7a", etc). Be sure that Build Action is "LibraryProjectZip" for the ".zip" file and "AndroidNativeLibrary" for the ".a" files (you can set to "None" the file that you don't use).

  • In the Android app project "Properties" check the option "Generate one package (.apk) per selected ABI" and check the "Supported architectures" in the "Advanced" tab.

Now you can simply click "Archive" using "Any CPU" for the Android app and the dedicated (and small!!) apks will be produced!

Best regards,
Marco

@jeremy-ellis-tech
Copy link
Owner

@MarcorOnline Thanks very much for the suggestion, how big is the resulting apk?

I'll close this issue and link it from the README next time I update the repo.

@MarcorOnline
Copy link
Author

The final size overhead on APK is exactly the sum of:

  • OpenCV.dll compiled with "None" profile (1.2 MB)
  • Included ".a" files (for example I've included only 6 of the 24 available)

Without using the "None" profile the ".a" files are included two times: one time in "OpenCV.dll" and one time in the native "lib" folder of the final APK. Using my approach the OpenCV overhead is about the half!! :)

I'm happy that my contribute can help other developers as your project has helped me to start with OpenCV on Xamarin Android.

I hope in a good (and modular!!!) Binding library for iOS (EmguCV is very big!).

@VetaLioSTV
Copy link

@MarcorOnline hi there. I want to port OpenCV via bindings for Xamarin.iOS. Stay tuned :) !

@jeremy-ellis-tech
Copy link
Owner

@MarcorOnline I've put a link to this issue in the updated README with credit. Thanks again.

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

No branches or pull requests

3 participants