Hi Davi,
thanks but unfortunately that doesn't help me. I'm developing a
Crosswalk extension for Android, and things are a bit custom.
I'm using gulp to orchestrate the build system, while the APK gets
ultimately built using Crosswalk's make_apk.py.

Ultimately, the APK looks like this:

assets/
  # My app plus the extension's JS
lib/
  x86/
    # The iotivity SO files and libxwalkcore.so
META-INF/
  # Manifest and certificates
res/
  # Icons and stuff
AndroidManifest.xml
classes.dex
README.md
resources.arsc


Does it look like it's missing anything?



On Tue, Jun 16, 2015 at 2:58 PM, Davi Di?rio Mendes
<ddioriomendes at gmail.com> wrote:
> Hi Salvatore,
>
> You don't need to load jni by yourself.
>
> At iotivity/android/android_api/base/build/outputs/aar/ you should find two
> files .aar, one debug and one release. Add these .aar files as module in
> Android Studio (on eclipse I don't know how to do).
>
> To add .aar file as module on android studio, you can follow the step 8 from
> iotivity/android/BuildInstructionsForAndroidAPI.txt
>
> I hope it helps you!
>
> 2015-06-15 8:45 GMT-03:00 Iovene, Salvatore <salvatore.iovene at intel.com>:
>>
>> Thanks,
>> upgrading to API level 21 did fix that particular problem. Btw, can
>> you advise on which of the libraries I need to load, and in what
>> order?
>>
>> I tried this:
>>
>>     static {
>>         Log.d(TAG, "Loading native libraries...");
>>         System.loadLibrary("connectivity_abstraction");
>>         System.loadLibrary("octbstack");
>>         System.loadLibrary("oc");
>>         System.loadLibrary("oc_logger");
>>         System.loadLibrary("gnustl_shared");
>>         System.loadLibrary("ca-interface");
>>         System.loadLibrary("ocstack-jni");
>>         Log.d(TAG, "Done loading native libraries.");
>>     }
>>
>> and Crosswalk complains about a mysterious (i.e. not better specified)
>> UnsatisfiedLinkError:
>>
>> D/XWALK_OIC( 2399): Loading native libraries...
>> I/JNI_CA_INTERFACE( 2399): CaInterface_initialize
>> I/CA_ADAPTER_UTILS( 2399): CANativeJNISetJavaVM
>> I/OIC-JNI ( 2399): JNI_OnLoad
>> D/AndroidRuntime( 2399): Shutting down VM
>> E/AndroidRuntime( 2399): FATAL EXCEPTION: main
>> E/AndroidRuntime( 2399): Process:
>> org.crosswalkproject.crosswalk_oic_demo, PID: 2399
>> E/AndroidRuntime( 2399): java.lang.UnsatisfiedLinkError: JNI_ERR
>> returned from JNI_OnLoad in
>>
>> "/data/app/org.crosswalkproject.crosswalk_oic_demo-1/lib/x86/libocstack-jni.so"
>> E/AndroidRuntime( 2399):     at
>> java.lang.Runtime.loadLibrary(Runtime.java:371)
>> E/AndroidRuntime( 2399):     at
>> java.lang.System.loadLibrary(System.java:989)
>> E/AndroidRuntime( 2399):     at
>> org.crosswalkproject.oic.OIC.<clinit>(OIC.java:30)
>> E/AndroidRuntime( 2399):     at
>> java.lang.reflect.Constructor.newInstance(Native Method)
>> E/AndroidRuntime( 2399):     at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:288)
>> E/AndroidRuntime( 2399):     at
>>
>> org.xwalk.app.runtime.extension.XWalkRuntimeExtensionManager.createExternalExtension(XWalkRuntimeExtensionManager.java:221)
>> E/AndroidRuntime( 2399):     at
>>
>> org.xwalk.app.runtime.extension.XWalkRuntimeExtensionManager.loadExternalExtensions(XWalkRuntimeExtensionManager.java:170)
>> E/AndroidRuntime( 2399):     at
>>
>> org.xwalk.app.runtime.extension.XWalkRuntimeExtensionManager.loadExtensions(XWalkRuntimeExtensionManager.java:132)
>> E/AndroidRuntime( 2399):     at
>>
>> org.xwalk.app.XWalkRuntimeActivityBase.tryLoadRuntimeView(XWalkRuntimeActivityBase.java:134)
>> E/AndroidRuntime( 2399):     at
>>
>> org.xwalk.app.XWalkRuntimeActivityBase.onCreate(XWalkRuntimeActivityBase.java:45)
>> E/AndroidRuntime( 2399):     at
>>
>> org.crosswalkproject.crosswalk_oic_demo.CrosswalkOicDemoActivity.onCreate(CrosswalkOicDemoActivity.java:21)
>> E/AndroidRuntime( 2399):     at
>> android.app.Activity.performCreate(Activity.java:5937)
>> E/AndroidRuntime( 2399):     at
>>
>> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
>> E/AndroidRuntime( 2399):     at
>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
>> E/AndroidRuntime( 2399):     at
>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
>> E/AndroidRuntime( 2399):     at
>> android.app.ActivityThread.access$800(ActivityThread.java:144)
>> E/AndroidRuntime( 2399):     at
>> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
>> E/AndroidRuntime( 2399):     at
>> android.os.Handler.dispatchMessage(Handler.java:102)
>> E/AndroidRuntime( 2399):     at android.os.Looper.loop(Looper.java:135)
>> E/AndroidRuntime( 2399):     at
>> android.app.ActivityThread.main(ActivityThread.java:5221)
>> E/AndroidRuntime( 2399):     at java.lang.reflect.Method.invoke(Native
>> Method)
>> E/AndroidRuntime( 2399):     at
>> java.lang.reflect.Method.invoke(Method.java:372)
>> E/AndroidRuntime( 2399):     at
>>
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
>> E/AndroidRuntime( 2399):     at
>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
>> W/ActivityManager( 1221):   Force finishing activity
>> org.crosswalkproject.crosswalk_oic_demo/.CrosswalkOicDemoActivity
>>
>>
>> If I try to omit `System.loadLibrary("ocstack-jni");`, then the JNI
>> loading completes with no errors, but when using `PlatformConfig` I
>> get:
>>
>> E/XWalkExtensionManager( 2461): Error in calling methods of external
>> extensions. java.lang.reflect.InvocationTargetException
>>
>> Unfortunately there are no more details in logcat.
>>
>> Ideas?
>> Thanks!
>>
>>
>>
>> On Fri, Jun 12, 2015 at 7:16 PM, Lenahan, Charlie
>> <charlie.lenahan at intel.com> wrote:
>> >
>> > This was covered in an earlier thread ~5/21/15 ,  that symbol was for
>> > android-21, which is what the build is set for.
>> >
>> > To run it on an older device you will have to change what it is
>> > targeting.
>> >
>> > On 6/12/15, 6:34 AM, "Iovene, Salvatore" <salvatore.iovene at intel.com>
>> > wrote:
>> >
>> >>Hi,
>> >>I built Iotivity for Android using the Scons README file and a recent
>> >>check out of the master branch, and I got a nice .aar file with
>> >>classes.jar and .so files. Great!
>> >>
>> >>I tried to use Iotivity in an Android app (really a Crosswalk
>> >>extension), but upon attempting to use "System.loadLibrary" to load
>> >>the .so files, I get this error at run time:
>> >>
>> >>E/dalvikvm(14417):
>>
>> >> >>dlopen("/data/app-lib/org.crosswalkproject.crosswalk_oic_demo-2/libconnect
>> >>ivity_abstraction.so")
>> >>failed: dlopen failed: cannot locate symbol
>> >>"pthread_condattr_setclock" referenced by
>> >>"libconnectivity_abstraction.so"...
>> >>
>> >>It looks like pthread cannot be found? Could I possibly be missing
>> >>something? This is on an Android 4.4.2 device.
>> >>
>> >>Thanks in advance!
>> >>Salvatore
>> >>
>> >>--
>> >>Salvatore Iovene <salvatore.iovene at intel.com>
>> >>Linux Software Engineer
>> >>Intel Open Source Technology Center, Finland
>> >>Tel.: +358504804026
>> >>_______________________________________________
>> >>iotivity-dev mailing list
>> >>iotivity-dev at lists.iotivity.org
>> >>https://lists.iotivity.org/mailman/listinfo/iotivity-dev
>>
>>
>>
>> --
>> Salvatore Iovene <salvatore.iovene at intel.com>
>> Linux Software Engineer
>> Intel Open Source Technology Center, Finland
>> Tel.: +358504804026
>> _______________________________________________
>> iotivity-dev mailing list
>> iotivity-dev at lists.iotivity.org
>> https://lists.iotivity.org/mailman/listinfo/iotivity-dev
>
>
>
>
> --
> Davi Di?rio Mendes
> Eng. de Computa??o - Turma de 2011
> Universidade de S?o Paulo - EESC/ICMC



-- 
Salvatore Iovene <salvatore.iovene at intel.com>
Linux Software Engineer
Intel Open Source Technology Center, Finland
Tel.: +358504804026

Reply via email to