Where to add SDK/JAR files in Steroids app structure


#1

Hi @ all,

I’m trying to add a plugin that relies on 3rd party libraries to my current app (specifically card.io -> https://github.com/vkeepe/card.io).

I had a look at the plugin.xml and saw that the following files are referenced:
lib-file src=“src/android/lib/card.io.jar” arch=“device” /
lib-file src=“src/android/lib/arm64-v8a” arch=“device” />
lib-file src=“src/android/lib/armeabi” arch=“device” />
lib-file src=“src/android/lib/armeabi-v7a” arch=“device” />
lib-file src=“src/android/lib/mips” arch=“device” />
lib-file src=“src/android/lib/mips64” arch=“device” />
lib-file src=“src/android/lib/x86” arch=“device” />
lib-file src=“src/android/lib/x86_64” arch=“device” />

I tried to copy the respective files into directories to the root of the project (multiview project) with the latest steroids version 4.0.6:
/src/android/lib
/lib
/libs
/www/lib
/www/libs

but nothing worked. I’m always getting a crash with the following message: “07-13 14:42:20.314: E/card.io(7813): Failed to load native library: Couldn’t load cardioDecider from loader dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.scanner.parkt.bla-1.apk”],nativeLibraryDirectories=[/data/app-lib/com.scanner.bla-1, /vendor/lib, /system/lib]]]: findLibrary returned null” which means that the library was not loaded.

I’m a bit at a loss as to where to manually copy in the JAR files to make them work and the AppGyver Docs don’t really deal with that issue. Any help would be much appreciated!

Thanks,
Alex


#2

I’m using this exact plugin. I’m confused about what you’re trying to do. Are you following these instructions?


#3

BenStyles

yes, I already added it to the Build and created my custom scanner - so the plugin is theoretically ready. The problem is that the JAR (card.io) file needs to be added separately within the app structure, so that on build it is copied to the Android libs directory.

I just don’t know where to put it in the Steroids app structure so that the JAR file is loaded correctly.

Anybody has any experience with that? It should be the same if I create a custom plugin with an external SDK and need to add it to the project…

thanks,
Alex


#4

Maybe you’re trying to use a feature of this plugin that I don’t know about, but I’m using it as we speak and I didn’t need to add any JAR files. The build service handles this for you, if the plugin is structured correctly, which this one is. Have you tried using the plugin in your javascript already?


#5

Ben,

really - it comes up on ANDROID, not IOS… just after adding the GIT to the Cloud Services under ‘Plugin Configuration’ and creating the custom scanner?

I added the plugin as described, I can also see that the namespace is registered via the console… as it calls the correct function… but it just crashes when I try to execute the demo call with ‘cardioDecider not found’, which points to that the SDK was not loaded (which is also described in github needs to be added seperately).

Are you on Skype, Hipchat, Whatsapp? I would love to just quickly follow up with you on that what the problem might be. I think it should be a very simple issue - I’m just missing something.

thanks,
Alex


#6

Hey Alex, sorry for the delay. This is worrying me now as I’ve only tried on iOS so far! So yeah let’s discuss it. I’m not on any of them actually, Google Hangouts?


#7

Ben, sure no worries.

I did some more digging and can definitely confirm that JAR files are not copied into the lib directory of the Custom Scanner app on Android - I tried to use a different extension as well where the JAR is included and the plugin.xml also references the destination directory. (e.g. https://github.com/freakypie/card.io-phonegap) and nothing works.

It does work for iOS though… I’m a bit stumped that this is not addressed by AppGyver. Is there nobody here that ran into the same issue or can provide any pointers as to how to get 3rd party libraries on Android to work with Appgyver?

thanks,
Alex


#8

I am curious about this issue as well. I was actually starting the process of adding card.io to my AppGyver project when I ran into this thread. I will continue to dig into this… I also have Google Hangouts if you guys wish to connect.


#9

Any updates from anybody? Still trying to figure this out for the next app update… seems strange that nobody is addressing this issue from the appgyver team?


#10

Just checking, are you putting these files inside your custom Cordova plugin? You cannot inject native code from the Steroids application, you’ll need to create a Cordova plugin for that. You can see what is injected by building the application.apk with your plugin included, and then “unzip application.apk” to see where the native libraries went. The correct folder is “libs”.

I just verified, and jar files injected from Cordova plugin do work.


#11

Hi, yes the files are in the cordova plugin - you can see the repo a few posts up. Unpacking the APK shows that the files were not correctly copied into the libs directory.

Do you have an example plugin where the injection worked?


#12

I checked the plugin.xml in the card.io project (https://github.com/vkeepe/card.io) and there is no reference to libs/.

Plugin.xml needs to declare which files should be copied into libs/, for example like this:
<source-file src="src/android/lib/MobileAppTracker-3.11.0.jar" target-dir="libs/" />

From https://github.com/MobileAppTracking/phonegap-plugin/blob/master/plugin.xml#L47