Jake quin
Jake quin

Reputation: 742

How to get libssl.so and libcrypto.so from apk

So i am try to build openSSL into my qt android app. and to all my efforts from using precompiled binary to installing ubuntu 18 and still failing i am getting desperate.

I have read from this thread:

QT + OpenSSL + Android

that i can get them from ANY existing apk, so how do i extract it from the apk? Because i do not find it in the android ndk and sdk. if its only selected apk, what program do i use indor for me to see it.

im using Qt 5.11 on windows, but i have linux OS too if needed :) Thank you!

Upvotes: 0

Views: 1669

Answers (2)

Jake quin
Jake quin

Reputation: 742

You can open them by simply changing their extension to ".zip" :) will update if i can find apps that has these files.

PS: No all apk has libcrypto.so and libssl.so.

Upvotes: 0

dtech
dtech

Reputation: 49289

I've built OpenSSL for android a few months ago, with zero issues. Just follow this guide for Linux:

export ANDROID_NDK_ROOT="/home/dev/android-ndk-r12b"
SR="$ANDROID_NDK_ROOT/platforms/android-16/arch-arm"
BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"


RANLIB="$BR"ranlib CC="$BR"gcc ./Configure android-armeabi --prefix=$SR/usr --sysroot=$SR
ANDROID_DEV=$SR/usr make
make install

Obviously, you will have to replace the paths with your own depending on where and what NDK version you install, and you will already have downloaded and extracted the OpenSSL source. Also, keep in mind that Qt doesn't seem to work with the latest and "greatest" android toolchains. In fact, android has already switched to llvm, but for Qt you will need to use the older gcc toolchains.

You can use this script to build libcrypto.

There are many prebuilt binaries you can get online, without having to rummage about in apk files, for example this repo has openssl libcrypto for a bunch of platforms, including android.

Don't know where you got the idea that you could get the libs from any apk file, obviously, it has to be a package from an application that incorporates those libraries for dynamic linking.

Last but not least, if you still plan on getting pre-compiled binaries, keep in mind they have to be built with a version that is compatible with your compiler. Which is why it is best to build the libs yourself, with the same toolchain you are using for your application. There is also the danger of getting "bad" libs from an unknown source, they might be outdated or tampered with.

Upvotes: 1

Related Questions