3

I've been trying this for quite a long time. I must have tried hundreds of different ways to make it work, but haven't had success yet. Let me describe what I'm trying to do.

I have got an Android Library Project called "androidservice" provided by a third party organisation. Because it is a close sourced project, the project only contains the relevant .jar file and its resources as shown in the project hierarchy below. (Please note, the actual .jar file is in the libs folder. I assume the one in the bin folder has no use because it has a very small size of 166byte and I take that it gets generated from an empty source when the project gets built).

enter image description here

I wanted to use this "androidservice" library project in Xamarin and I read many times the instructions on http://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)/

And I created an Android Java Binding Library in Xamarin and a zip file is added to it based on the last section of article of the link above. The structure of the binding project is shown below.

enter image description here

Where thirdparty.zip contains the bin folder and res folder of the "androidservice" project.

Now, because the original androidservice.jar in the bin folder doesn't seem to be a proper one (only 166byte) and with this jar file, the binding project gives an error of "at least one input jar must be specified" during build, I replaced this small jar with the "androidservice.jar" in the libs folder which has a much larger size of 845kb. The jar files in the Jars folder are all set to be "EmbeddedReferenceJar".

I then referenced this binding library in my Xamarin android project by adding it in the references.

With this set up, both the binding library and the android project builds. However, when running the app in debug mode on an Android phone, the error message:

[AndroidRuntime] java.lang.UnsatisfiedLinkError: Couldn't load opus from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.company.myApp-1.apk,libraryPath=/data/app-lib/com.company.myApp-1]: findLibrary returned null
[AndroidRuntime]    at java.lang.Runtime.loadLibrary(Runtime.java:358)
[AndroidRuntime]    at java.lang.System.loadLibrary(System.java:526)
[AndroidRuntime]    at com.thirdparty.eptt.android.service.RealVoice$3.run(RealVoice.java:194)

The word opus seems to suggest it is something to do with the libopus.so.

I looked into all the links below, but none helped. http://forums.xamarin.com/discussion/8773/how-to-handle-so-libs-in-java-bindings-library

http://forums.xamarin.com/discussion/2267/using-a-java-library-and-a-native-library-jar-and-so-java-lang-unsatisfiedlinkerror

http://forums.xamarin.com/discussion/6088/loading-native-library

Any suggestions to possible solutions or ways to further debug it would be much appreciated.

full output:

[SELinux] Function: selinux_android_load_priority [0], There is no sepolicy file.
[SELinux]  
[SELinux] Function: selinux_android_load_priority , spota verifySig and checkHash pass. priority version is VE=SEPF_GT-I9505_4.4.2_0032
[SELinux]  
[SELinux]  
[SELinux] selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8846,server=y,embedding=1
[libc] WARNING: generic atexit() called from legacy shared library
[Mono] Image addref mscorlib[0x7257ce00] -> mscorlib.dll[0x7257c230]: 1
[Mono] AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib/mscorlib.dll.so" not found
[Mono] Assembly mscorlib[0x7257ce00] added to domain RootDomain, ref_count=1
[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll'.
[Mono] Image addref MyAppAndroid[0x728c7eb0] -> /storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll[0x728c72e8]: 2
[Mono] Assembly MyAppAndroid[0x728c7eb0] added to domain RootDomain, ref_count=1
[Mono] AOT module '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib//storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll.so" not found
[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll'.
[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/MyAppAndroid.dll.config'.
[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/MyAppAndroid/MyAppAndroid.config'.
[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll'.
[Mono] Image addref Bindings[0x728cce50] -> /storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll[0x728cc228]: 2
[Mono] Assembly Bindings[0x728cce50] added to domain RootDomain, ref_count=1
[Mono] AOT module '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib//storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll.so" not found
[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll'.
[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/com.company.myApp/files/.__override__/Bindings.dll.config'.
[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.18-series/3b7ef0a7/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/Bindings/Bindings.config'.
[monodroid-gc] GREF GC Threshold: 46800
[Mono] Image addref Mono.Android[0x728cc1c8] -> Mono.Android.dll[0x72904328]: 1
[Mono] Assembly Mono.Android[0x728cc1c8] added to domain RootDomain, ref_count=1
[Mono] AOT module 'Mono.Android.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib/Mono.Android.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x728cc1c8] -> mscorlib[0x7257ce00]: 2
[Mono] Assembly Ref addref Bindings[0x728cce50] -> mscorlib[0x7257ce00]: 3
[Mono] Assembly Ref addref Bindings[0x728cce50] -> Mono.Android[0x728cc1c8]: 2
[Mono] Image addref System.Core[0x7c6e5548] -> System.Core.dll[0x7c6daf18]: 1
[Mono] Assembly System.Core[0x7c6e5548] added to domain RootDomain, ref_count=1
[Mono] AOT module 'System.Core.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib/System.Core.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x728cc1c8] -> System.Core[0x7c6e5548]: 2
[Mono] Assembly Ref addref System.Core[0x7c6e5548] -> mscorlib[0x7257ce00]: 4
[Mono] Assembly Ref addref MyAppAndroid[0x728c7eb0] -> Mono.Android[0x728cc1c8]: 3
[Mono] Assembly Ref addref MyAppAndroid[0x728c7eb0] -> mscorlib[0x7257ce00]: 5
[Mono] Assembly Ref addref MyAppAndroid[0x728c7eb0] -> Bindings[0x728cce50]: 2
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gref_log_new'.
[Mono] Probing '_monodroid_gref_log_new'.
[Mono] Found as '_monodroid_gref_log_new'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Probing '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Found as '_monodroid_gc_wait_for_bridge_processing'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_get_identity_hash_code'.
[Mono] Probing '_monodroid_get_identity_hash_code'.
[Mono] Found as '_monodroid_get_identity_hash_code'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gref_log_delete'.
[Mono] Probing '_monodroid_gref_log_delete'.
[Mono] Found as '_monodroid_gref_log_delete'.
[DemoActivity] OnCreate: start
[DemoActivity] OnCreate: Core Service is not running.. ViewInitializing
[DemoActivity] viewInitializing
[ProgressBar] setProgressDrawable drawableHeight = 18
[Mono] Image addref System.Xml[0x7c909a38] -> System.Xml.dll[0x7c908f68]: 1
[Mono] Assembly System.Xml[0x7c909a38] added to domain RootDomain, ref_count=1
[Mono] AOT module 'System.Xml.dll.so' not found: dlopen failed: library "/data/data/com.company.myApp/lib/System.Xml.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x728cc1c8] -> System.Xml[0x7c909a38]: 2
[Mono] Assembly Ref addref System.Xml[0x7c909a38] -> mscorlib[0x7257ce00]: 6
[DemoActivity] onCreate, installer: , False
[DemoActivity] onResume DemoActivity
[DemoActivity] onResume -> Service is not bound
[Adreno-EGL] <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build:  (CL3869936)
[Adreno-EGL] OpenGL ES Shader Compiler Version: 17.01.11.SPL
[Adreno-EGL] Build Date: 01/17/14 Fri
[Adreno-EGL] Local Branch: 
[Adreno-EGL] Remote Branch: 
[Adreno-EGL] Local Patches: 
[Adreno-EGL] Reconstruct Branch: 
[OpenGLRenderer] Enabling debug mode 0
[DemoActivity] CoreStarterRunnable : Run. Trying to bind
[ContextImpl] Failed to ensure directory: /storage/extSdCard/Android/data/com.company.myApp/files
[RU] getDebugDirectoryName:/storage/emulated/0/Android/data/com.company.myApp/files
[Debugger] openNewFile: 0, append: true
[CHATAPP] 11:35:31.821:  WARN: SERV CHATAPP: Starting Version 1.0 (Build 300)
[CHATAPP] 11:35:31.829: ERROR: SERV error reading config file: java.io.FileNotFoundException: /data/data/com.company.myApp/files/config.json: open failed: ENOENT (No such file or directory)
[CHATAPP] 11:35:31.830: DEBUG: SERV readConfig
[CHATAPP] 11:35:31.830: DEBUG: SERV config file does not exist
[CHATAPP] 11:35:31.834: DEBUG: RDB DB: Filesystem root: 
[CHATAPP] 11:35:31.834: DEBUG: SERV register media button
[CHATAPP] 11:35:31.835: DEBUG: SERV create Savox PTT
[CHATAPP] 11:35:31.852: DEBUG: SERV getMetaDataString: floorDenyTone: null
[CHATAPP] 11:35:31.853: DEBUG: SERV getMetaDataString: rxNewMessageTone: null
[CHATAPP] 11:35:31.859: DEBUG: RV registerHeadsetReceiver
[CHATAPP] 11:35:31.861: DEBUG: HR onReceive
[CHATAPP] 11:35:31.863: DEBUG: RV isBluetoothAllowed: false
[CHATAPP] 11:35:31.865: DEBUG: SERV setImplicitDnd: old=false, RM=1
[CHATAPP] 11:35:31.866: ERROR: SERV error reading config file: java.io.FileNotFoundException: /data/data/com.company.myApp/files/config.json: open failed: ENOENT (No such file or directory)
[CHATAPP] 11:35:31.866: DEBUG: SERV readConfig
[CHATAPP] 11:35:31.867: DEBUG: SERV config file does not exist
[CHATAPP] 11:35:31.867: DEBUG: RV requestAudioFocus force=true
[CHATAPP] 11:35:31.871: DEBUG: RV Got audio focus
[CHATAPP] 11:35:31.879: ERROR: SERV error reading config file: java.io.FileNotFoundException: /data/data/com.company.myApp/files/config.json: open failed: ENOENT (No such file or directory)
[CHATAPP] 11:35:31.880: DEBUG: SERV readConfig
[CHATAPP] 11:35:31.887: DEBUG: SERV config file does not exist
[CHATAPP] 11:35:31.889: DEBUG: SERV getMetaDataBoolean: useVoicePrivacy: false
[CHATAPP] 11:35:31.891: DEBUG: CO Construct
[CHATAPP] 11:35:31.892: DEBUG: SERV LMR: createNetwork: 
[AndroidRuntime] FATAL EXCEPTION: Thread-844
[AndroidRuntime] Process: com.company.myApp, PID: 2323
[AndroidRuntime] java.lang.UnsatisfiedLinkError: Couldn't load opus from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.company.myApp-1.apk,libraryPath=/data/app-lib/com.company.myApp-1]: findLibrary returned null
[AndroidRuntime]    at java.lang.Runtime.loadLibrary(Runtime.java:358)
[AndroidRuntime]    at java.lang.System.loadLibrary(System.java:526)
[AndroidRuntime]    at com.thirdparty.eptt.android.service.RealVoice$3.run(RealVoice.java:194)
[CHATAPP] 11:35:31.894: DEBUG: MDB getUnopenedMessageCount
[CHATAPP] 11:35:31.938: DEBUG: MDB Creating message database
[CHATAPP] 11:35:31.952: DEBUG: MDB got 0 unopened messages
[CHATAPP] 11:35:31.952: DEBUG: SERV Message Notify new=0, unopened=0, force=true
[CHATAPP] 11:35:32.074: DEBUG: SERV Update Notification: serverError: true, lowerLayerUp: true, errorBits: 0x0, display: false
[CHATAPP] 11:35:32.075: DEBUG: SERV NotificationChange: icon -1->2130837534, message -1->0
[CHATAPP] 11:35:32.178: DEBUG: SERV Update Notification: serverError: true, lowerLayerUp: true, errorBits: 0x0, display: false
[CHATAPP] 11:35:32.231: DEBUG: SERV onStartCommand
[CHATAPP] 11:35:32.232: DEBUG: SERV startCore
[CHATAPP] 11:35:32.234: ERROR: SERV error reading config file: java.io.FileNotFoundException: /data/data/com.company.myApp/files/config.json: open failed: ENOENT (No such file or directory)
[CHATAPP] 11:35:32.235: DEBUG: SERV readConfig
[CHATAPP] 11:35:32.236: DEBUG: SERV config file does not exist
[CHATAPP] 11:35:32.238: DEBUG: SERV onBind
[CHATAPP] 11:35:32.246: DEBUG: CR ConnectivityReceiver: [WiFi(1)], connected:true, networkInfo: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: "WirelessA", roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
[CHATAPP] 11:35:32.251: DEBUG: CR ActiveNetwork: [WiFi(1)], connected:true, networkInfo: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: "WirelessA", roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
[CHATAPP] 11:35:32.275: DEBUG: CR Network changed: type -1->1, subtype -1->0
[CHATAPP] 11:35:32.281: DEBUG: CR IP Address Change null->/fe80::40f3:8ff:fefd:f24d%p2p0%11
[CHATAPP] 11:35:32.283:  WARN: SERV setNetworkType: type: 1, lastNetworkSpeedType: 1
[CHATAPP] 11:35:32.284:  WARN: CM: Skip NetworkChangedEvent since IdleProc is unregistered or busy
[CHATAPP] 11:35:32.289: DEBUG: SERV ringerModeChange: 1, 0
[CHATAPP] 11:35:32.290: DEBUG: SERV setImplicitDnd: old=false, RM=1
[CHATAPP] 11:35:32.292: ERROR: SERV error reading config file: java.io.FileNotFoundException: /data/data/com.company.myApp/files/config.json: open failed: ENOENT (No such file or directory)
[CHATAPP] 11:35:32.293: DEBUG: SERV readConfig
[CHATAPP] 11:35:32.294: DEBUG: SERV config file does not exist
[DemoActivity] onPause: CONTACT
[BA] OnServiceConnected
[DemoActivity] CoreBoundListener onBind 
[DemoActivity] init 42ae9d08
[CHATAPP] 11:35:32.362: DEBUG: SERV setListViewState: CONTACT
4

0 回答 0