Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

I am trying to add a card.io plugin in my project. I have successfully added the Java and JavaScript file. If I export the project and run via Eclipse, then it works fine. However, when I try to build it online, it gives lots of error. The error is related to those jar files and .so files, the build service is unable to include those files .
I added the jar and .so files in the lib folder.
I also tried the answer provided here, it didn't work. The project is still giving the Build error (not a descriptive one).
https://getsatisfaction.com/apperyio/...

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Adding Plugins with JAR and .SO library files

Rahul,

We are sorry, but you need to debug it.
There is no easy way to say what's the problem

Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

Just tell me a process to add .jar and .so files, so that it gets included in the build. Since the project works fine, if I import it to Eclipse.

Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

I finally got it building. I modified the pom.xml file by adding the libs dependency path of jar. However, I am getting the class not found exception while running the apk on my device. This is the error -

03-30 18:09:54.007: E/AndroidRuntime(21914): FATAL EXCEPTION: main
03-30 18:09:54.007: E/AndroidRuntime(21914): Process: io.appery.project279867, PID: 21914
03-30 18:09:54.007: E/AndroidRuntime(21914): java.lang.NoClassDefFoundError: io.card.payment.CardIOActivity
03-30 18:09:54.007: E/AndroidRuntime(21914): at com.velocitywebworks.plugins.cardio.CardIOMain.onCreate(CardIOMain.java:32)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.Activity.performCreate(Activity.java:5231)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.ActivityThread.access$800(ActivityThread.java:144)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.os.Handler.dispatchMessage(Handler.java:102)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.os.Looper.loop(Looper.java:136)
03-30 18:09:54.007: E/AndroidRuntime(21914): at android.app.ActivityThread.main(ActivityThread.java:5179)
03-30 18:09:54.007: E/AndroidRuntime(21914): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 18:09:54.007: E/AndroidRuntime(21914): at java.lang.reflect.Method.invoke(Method.java:515)
03-30 18:09:54.007: E/AndroidRuntime(21914): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
03-30 18:09:54.007: E/AndroidRuntime(21914): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
03-30 18:09:54.007: E/AndroidRuntime(21914): at dalvik.system.NativeStart.main(Native Method)

The class io.card.payment.CardIOActivity is present in the jar file. However, if I export the project to Eclipse and directly run it without modifying any configuration, the app works perfectly. The changes which I made to POM file is this -
pre
<dependency>
<groupId>card&#46;io</groupId>
<artifactId>card&#46;io</artifactId>
<scope>system</scope>
<version>5&#46;0&#46;0</version>
<systemPath>${basedir}/libs/card&#46;io&#46;jar</systemPath>
</dependency>
/pre

Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

After researching I found that adding a system scope dependency is not a proper method. So I redo the changes, as shown in the attached images and now I am back to the Build Error. I do not understand what is the exact error, it just shows the build error.
I also configured the maven on my local machine and successfully build the same project using maven also without any configuration. Therefore project works fine if I use Eclipse or Maven, it just doesn't work when I build it online.
So what is exactly causing the issue?

Image Image Image Image

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Adding Plugins with JAR and .SO library files

Hello Rahul,

1) check if your jar already in maven, by checking it on mvnrepository.org
if jar wasn't found
2) create repo/xxx/yyy/zzz.jar, repo/xxx/yyy/zzz.pom
where xxx/yyy/zzz - package name of your jar file
3) add dependency to pom.xml
http://gyazo.com/9a81175806f6e19841e5...

PACKAGE_NAME
JAR-ARTIFACT
VERSION

if jar was found, then simply add dependency to pom.xml
http://gyazo.com/9a81175806f6e19841e5...

Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

Thank you for replying.
The app is getting build now. I am currently listing my steps backward, to get the exact cause of the issue.

Rahul Pandey
Posts: 0
Joined: Fri Mar 27, 2015 3:03 pm

Adding Plugins with JAR and .SO library files

I want to recreate the app, but do not want to work with the design and services part. What is the best way to restore only design and services?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Adding Plugins with JAR and .SO library files

Make a backup file before editing the source files or using App versions and save the version before source editing.

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Adding Plugins with JAR and .SO library files

Just to be sure,
forum removed some tags
code
<dependency>
<groupId>PACKAGE_NAME</groupId>
<artifactId>JAR-ARTIFACT </artifactId>
<version>VERSION </version>
</dependency>
/code

Return to “Issues”