[Android] Use libc++ as static library

Jean-Baptiste Kempf git at videolan.org
Thu Oct 19 14:26:20 CEST 2017


vlc-android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Oct 19 14:25:46 2017 +0200| [b9df53313bae2fffb9622d725060bd3f6fc5d68a] | committer: Jean-Baptiste Kempf

Use libc++ as static library

Too many crashes in the LoadLibrary for unknown reasons

> https://code.videolan.org/videolan/vlc-android/commit/b9df53313bae2fffb9622d725060bd3f6fc5d68a
---

 compile-libvlc.sh                                            | 8 ++++----
 libvlc/src/org/videolan/libvlc/LibVLC.java                   | 1 -
 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 1 -
 vlc-android/build.gradle                                     | 7 -------
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 2125cbe33..de8cb9781 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -414,7 +414,7 @@ if [ "${ANDROID_ABI}" = "armeabi-v7a" ];then
     NDK_LIB_UNWIND="-lunwind"
 fi
 
-EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -L${NDK_LIB_DIR} -lc++abi ${NDK_LIB_UNWIND}"
+EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -L${NDK_LIB_DIR} -lc++abi ${NDK_LIB_UNWIND} -lc++_static"
 VLC_LDFLAGS="${EXTRA_LDFLAGS}"
 
 # Release or not?
@@ -713,7 +713,7 @@ if [ $ON_WINDOWS -eq 1 ]; then
 fi
 
 $ANDROID_NDK/ndk-build$OSCMD -C libvlc \
-    APP_STL="c++_shared" \
+    APP_STL="c++_static" \
     LOCAL_CPP_FEATURES="rtti exceptions" \
     VLC_SRC_DIR="$VLC_SRC_DIR" \
     VLC_BUILD_DIR="$VLC_SRC_DIR/$VLC_BUILD_DIR" \
@@ -887,10 +887,10 @@ MEDIALIBRARY_LDLIBS="-L$SRC_DIR/libvlc/jni/libs/$ANDROID_ABI -lvlc \
 -L${MEDIALIBRARY_BUILD_DIR}/build-android-$ANDROID_ABI/.libs -lmedialibrary \
 -L$SRC_DIR/vlc/contrib/contrib-android-$TARGET_TUPLE/jpeg/.libs -ljpeg \
 -L$MEDIALIBRARY_MODULE_DIR/$SQLITE_RELEASE/build-$ANDROID_ABI/.libs -lsqlite3 \
--L${NDK_LIB_DIR} -lc++abi ${NDK_LIB_UNWIND}"
+-L${NDK_LIB_DIR} -lc++abi ${NDK_LIB_UNWIND} -lc++_static"
 
 $ANDROID_NDK/ndk-build -C medialibrary \
-    APP_STL="c++_shared" \
+    APP_STL="c++_static" \
     ANDROID_SYS_HEADERS="$ANDROID_SYS_HEADERS" \
     APP_BUILD_SCRIPT=jni/Android.mk \
     APP_PLATFORM=android-${ANDROID_API} \
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 3629a044d..3788a1169 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -151,7 +151,6 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
             return;
         sLoaded = true;
 
-        System.loadLibrary("c++_shared");
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1
                 && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
             try {
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 3ef504216..f087e6fcc 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -69,7 +69,6 @@ public class Medialibrary {
 
     static {
         LibVLC.loadLibraries();
-        System.loadLibrary("c++_shared");
         System.loadLibrary("mla");
     }
 
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 4473fd293..056c182ff 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -2,13 +2,6 @@ apply plugin: 'com.android.application'
 
 android {
     packagingOptions {
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/armeabi/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/mips/libc++_shared.so'
-        pickFirst 'lib/mips64/libc++_shared.so'
     }
 
     dexOptions {



More information about the Android mailing list