I succesfully compiled PJSIP library for Android. Sample project works without any problems when I build for default architecture armeabi. Now I tried to compile library for arch such as armeabi-v7a and arm64-v8a. Unfortunately when I add libraries to project in appropriate folders (jnLibs/armeabi-v7a and jniLibs/arm64-v8a) application is not starting...
To setup build for different archs I use this command:
NDK_TOOLCHAIN_VERSION=4.9 TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
I have this error on app launch:
07-04 12:28:46.079 15317-15317/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.futuremind.omili, PID: 15317
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getifaddrs" referenced by "/data/app/com.futuremind.omili-1/lib/arm/libpjsua2.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.futuremind.omili.MyApp.<clinit>(MyApp.java:293)
at com.futuremind.omili.MainActivity.onCreate(MainActivity.java:87)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535)
at android.app.ActivityThread.access$900(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5497)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Thanks for any help! :)
I was able to fix this error by updating the AndroidManifest.xml in "pjsip-apps/src/swig/java/android/app/src/main" to match my android target -- in my case to "23". Then "make clean" and another "make" in "pjsip-apps/src/swig", and rebuilding my app.
I have two .aar files that I need to add to my project as dependencies. I imported the projects and did the following and it worked just fine.
dependencies {
compile project(':zoomcommonlib')
compile project(':zoomsdk')
}
However, I have added many other libraries and I had to use MultiDex library to support apps over 64K methods
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile project(':zoomcommonlib')
compile project(':zoomsdk')
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
.....
}
Yes, MultiDex is properly setup because I can build the application and run it with no problem.
The problem: When I try to utilize those specific projects, application crashes. Following Log:
18790-18790/com.mypackage.name E/UncaughtException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mypackage.name-1/base.apk", zip file "/data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mypackage.name-1/lib/arm64, /data/app/com.mypackage.name-1/base.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libzoom_stlport.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1530)
at com.zipow.cmmlib.AppContext.<clinit>(AppContext.java:31)
at com.zipow.cmmlib.AppContext.initialize(AppContext.java:64)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:225)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:184)
at com.mypackage.name.SectionListActivity.getInitializedZoomSDK(SectionListActivity.java:857)
at com.mypackage.name.SectionListActivity.access$1500(SectionListActivity.java:88)
at com.mypackage.name.SectionListActivity$8.onClick(SectionListActivity.java:812)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
18790-18899/com.mypackage.name D/FA: Logging event (FE): _ae, Bundle[{_o=crash, _sc=SectionListActivity, _si=7450316610930895524, timestamp=1488996958198, fatal=1}]
18790-18899/com.mypackage.name V/FA: Using measurement service
18790-18899/com.mypackage.name V/FA: Connecting to remote service
--------- beginning of crash
18790-18790/com.mypackage.name E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mypackage.name, PID: 18790
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mypackage.name-1/base.apk", zip file "/data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mypackage.name-1/lib/arm64, /data/app/com.mypackage.name-1/base.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libzoom_stlport.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1530)
at com.zipow.cmmlib.AppContext.<clinit>(AppContext.java:31)
at com.zipow.cmmlib.AppContext.initialize(AppContext.java:64)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:225)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:184)
at com.mypackage.name.SectionListActivity.getInitializedZoomSDK(SectionListActivity.java:857)
at com.mypackage.name.SectionListActivity.access$1500(SectionListActivity.java:88)
at com.mypackage.name.SectionListActivity$8.onClick(SectionListActivity.java:812)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
From my understanding, those project dependencies are not properly getting added with MultiDex enabled. Is there some configuration that I am missing for project dependencies?
I've also tried the following in my build.gradle file.
dexOptions {
preDexLibraries = false
}
It seems to have no effect on it. It crashes each time.
The ZoomSDK you have doesn't support 64bit Android, unfortunately. In the mean time, you need to disable the use of 64bit libraries in your app and only support the mentioned framework so it builds in 32bit mode.
Add the following to the build.gradle of the main module of your app:
android {
defaultConfig {
ndk {
abiFilters "armeabi-v7a"
}
}
}
From the Zoom forum:
We support only 32 bit libs now. To work on 64 bit devices, you should
not use other 64 bit libs ( from other projects or other third party
SDK). Android OS can support 32 bit libs on 64 bit devices if you
don't have other 64 bit libs in the project
For x86, it can be supported via Intel ARM binary translator
(Houdini). But your app should not contain other x86 targeted native
binaries.
In order for the app to run on x86, all the binary files in your app should target on ARM, binary translator will translate them to
support x86.
If your app contains other binary files that target on x86, you should delete those files to remain only ARM targets. Because on x86
devices, if an app have binary files target on x86, it also should
have the file that target on ARM. Because Zoom Android SDK does not
contains any x86 binaries, so other files also can't have binaries
that target on x86 in order for the SDK to run.
The ARM binary translator works at run time, not at compile time.
You only need to add following to main gradle file
android {
defaultConfig {
ndk {
abiFilters "armeabi-v7a"
}
}
}
and in gradle.properties file add the following line
android.useDeprecatedNdk = true
I'm having an app and which works in android Lollipop and above, if I installed the app in android Kitkat device, the application crashes and show the error as below:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.SplashActivity" on path: DexPathList[[zip file "/data/app/com.partner-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.partner-1, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2131)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.SplashActivity" on path: DexPathList[[zip file "/data/app/com.partner-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.partner-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
I tried a lot and was not able to fix it, most of the answers are for eclipse projects.
The reason for api 21 on is:
Android 5.0 (API level 21) and higher uses a runtime called ART which natively supports loading multiple DEX files from APK files. ART performs pre-compilation at app install time which scans for classesN.dex files and compiles them into a single .oat file for execution by the Android device. Therefore, if your minSdkVersion is 21 or higher, you do not need the multidex support library.
From this guide: https://developer.android.com/studio/build/multidex.html
I solved the class not found error by naming my classes like this:
[Activity(Name = "somepackage.custombuttonrenderer")]
public class CustomButtonRenderer: ButtonRenderer
{ }
Here is my answer: Why is my custom ButtonRenderer not working?
Update you app level build.gradle file:
implementation 'com.android.support:multidex:1.0.0'
And update you application class with :
#Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
}
This worked to me:
Add this in your APLICATION class.
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(getBaseContext());
}
Explanation:
Android app (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536
Versions of the platform prior to Android 5.0 (API level 21) use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can add the multidex support
I'm new to Android Studios and I am doing this OCR http://swlock.blogspot.com/2016/07/ocr-tesseract-2.html where the image convert to text but everytime I take an image app the will close and got this error. Anyone can guide me to fix this error? Thanks
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.datumdroid.android.ocr.simple, PID: 2425
java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.datumdroid.android.ocr.simple/files/instant-run/dex/slice-slice_0-classes.dex"],nativeLibraryDirectories=[/data/app/com.datumdroid.android.ocr.simple-2/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libjpgt.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:214)
at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onActivityResult(SimpleAndroidOCRActivity.java:138)
at android.app.Activity.dispatchActivityResult(Activity.java:6915)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4049)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Application terminated.
That means that the *.so files are not in your *.apk file. Follow the steps in this stackoverflow question/answer.
You can always go to Build > Analyze APK... to see if the *.so files are getting added. Obviously, if they are not in the APK, then there is no reason to attempt to run the app that needs the *.so files.
I am following a youtube tutorial on how to make an android (probably not but I can hope for compatability) and iOS game using LibGDX and I have encountered a problem accessing a .tmx file from my res folder.
tileMap = new TmxMapLoader().load("res/level1.tmx");
using the above code I figured that the application would find my .tmx file in my res folder but I must be giving it incorrect information on how to find a file I have open in another tab. here is a screenshot of the search method called by hitting shift twice. http://imgur.com/PYd9Y5T
I see the file in the search method, but no matter what I seem to type in I cannot find level1.tmx
01-24 20:14:01.717 10013-10040/com.mac.elevator.android E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 60898
Process: com.mac.elevator.android, PID: 10013
com.badlogic.gdx.utils.SerializationException: Error parsing file: res/level1.tmx
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:83)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:92)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:80)
at com.mac.elevator.com.mac.elevator.states.Play.<init>(Play.java:91)
at com.mac.elevator.handlers.GameStateManager.getState(GameStateManager.java:35)
at com.mac.elevator.handlers.GameStateManager.pushState(GameStateManager.java:45)
at com.mac.elevator.handlers.GameStateManager.<init>(GameStateManager.java:22)
at com.mac.elevator.Game.create(Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1521)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1249)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: res/level1.tmx (Internal)
at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:92)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:80)
at com.mac.elevator.com.mac.elevator.states.Play.<init>(Play.java:91)
at com.mac.elevator.handlers.GameStateManager.getState(GameStateManager.java:35)
at com.mac.elevator.handlers.GameStateManager.pushState(GameStateManager.java:45)
at com.mac.elevator.handlers.GameStateManager.<init>(GameStateManager.java:22)
at com.mac.elevator.Game.create(Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1521)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1249)
Caused by: java.io.FileNotFoundException: res/level1.tmx
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:316)
at android.content.res.AssetManager.open(AssetManager.java:290)
at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:75)
test this, copy the asset of your game, go to the folder of Android project, because that is how it works, LibGDX, is that the wiki LibGDX, talk about this but I do not remember where, try to put the file .tmx inside folder:
AndroidProyect -> asset -> maps -> yourmap.tmx.
and try to call it:
tileMap = new TmxMapLoader().load("maps/level1.tmx");
in your case, the, resources should go in the Asset Android project folder. While our code will be in the project completion "Core".