After got success on compiling my to libvcl.so for arm64-v8a and x86_64 in release mode under Ubuntu, and then moved in my Android Studio project adding in build.gradle:
android {
namespace 'myproject
compileSdk 34
androidResources {
generateLocaleConfig true
}
defaultConfig {
applicationId "myproject"
minSdk 26
targetSdk 33
versionCode 5
versionName '2.3'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildToolsVersion '34.0.0'
sourceSets {
main {
//jniLibs.srcDir('src/main/jniLibs')
}
}
splits {
abi {
enable true
reset()
include "x86_64" , "arm64-v8a"
universalApk false
}
}
}
ext.abiCodes = [x86_64:1, 'arm64-v8a':2]
and adding in MainActivity:
public class MainActivity extends AppCompatActivity {
static {
//System.loadLibrary("c++_shared");
//System.loadLibrary("vlcjni");
System.loadLibrary("vlc");
}
.
.
.
}
and inserting in the requested .java file :
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.util.VLCVideoLayout;
and so on...then putting .so libraries just under jniLibs/arm64-v8a and jniLibs/x86_64 .
If I compile directly in debug mode to the mobile phone , it works at all. Even if I disconnect the mobile phone from the PC and start the app itself it works and I can play audio and video, totally happy.
But if I generate APK as release, then if I call the page that should initialize the libvlc , it crashes with this error:
FindClass(org/videolan/libvlc/interfaces/IMedia$Slave) failed
Can't load vlcjni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/~~DKbqsxDrx0Jyd0652P5lhg==/........-IgwGtHhM5vTdQLwyhcry4w==/base.apk!/lib/arm64-v8a/libvlcjni.so"
do you all know if it would be related to the Ubuntu compilation around linking maybe? Or maybe it needs some certain parameters in Android Studio when I am building in release mode? Because if on debug mode, it works and in release mode no, it makes me thinking in debug mode Android Studio inserts some link to libvlcjni.so (which is present in the directory), instead it doesn't in release mode so it crashes... Thanks to all in advance!
Cheers