Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Problem adding JAR files using Android Studio
posted

Hello,

I'm using AS (Android Studio) instead of Eclipse and running into a few issues I'm hoping you guys can help me overcome. Android Studio is superior to Eclipse and maintained by Google now as the official OS so I think it would behoove Infragistics to help potential mobile customers get past this (yes, the Android controls are free and THANK YOU for them :) but many of us also develop for iOS and will be strongly considering paying for the iOS versions of these if they work out for us).

 I've opened many of the supplied samples in AS using the "Import Project" feature (AS supports Eclipse project types) and everything compiles and runs without issue.

My problem is trying to create a new project in AS and bring over the needed JAR files to give me the functionality I'm seeing the LineSeries demo.

To help make this reproducible I've created a new project in AS and added a single blank Activity. The activity has a LinearLayout with a single Button on it. The button has an on click event that I'll populate later. So I can run my new empty AS project on device and it looks fine, I close it. Here are the steps that follow.

1. I copy the common and datachart JAR files and place them in my \libs folder 

2. I go into File -> Project Structure and add these two files to Libraries.

3. I open up build.grandle and make sure these JAR files are added to dependences like so

dependencies {

    compile files('libs/android-support-v4.jar')

    compile files('libs/common.jar')

    compile files('libs/datachart.jar')

}

4. Into  AS I create a new Activity called LineSeriesActivity and name it's layout main (mirroring naming conventions found in the demo to save time)

5.  Copy the layout and content of LineSeriesActivity from the LineSeriesActivity sample projects provided by Infragistics and paste them into the new project. 

6.  Add some functionality in the on click event of our blank activity so that when the button is pressed it launches the LineSeriesActivity, like so:

        Intent intent = new Intent(this, LineSeriesActivity.class);

            startActivity(intent);

7. Confirm our imports resolve in LineSeriesActivity java file (they will if steps 1-3 are completed) then confirm a successful build.

8. Run in debug mode on device. Blank Activity with push button should appear, press the button while watching the Android device log cat, you'll see something like this.

W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/iguanaui/controls/DataChart;)

07-30 22:43:24.713    4328-4328/com.bigtrax.pingcompare        E/dalvikvm: Could not find class 'com.iguanaui.controls.DataChart', referenced from method com.bigtrax.pingcompare.LineSeriesActivity.createChart

07-30 22:43:24.713    4328-4328/com.bigtrax.pingcompare        W/dalvikvm: VFY: unable to resolve check-cast 580 (Lcom/iguanaui/controls/DataChart;) in Lcom/bigtrax/pingcompare/LineSeriesActivity;

Not good…

From what I can gather, it looks like the JAR files just aren't being bundled and delivered to the device. Perhaps this is easy to overcome? It seems the Android Studio way and the Eclipse way are different so maybe someone can help. 

Thanks for making these controls free. I've been a fan of your products for years.

Jeremy

  • 48586
    posted

    Hello, ­­­­­

     

    I am just checking about the progress of this issue. Let me know If you need my further assistance on this  issue?

     

    Thank you for using Infragistics Components.

  • 48586
    posted

    Hello,

     

    Please confirm that common.jar and datachart.jar are added to libs folder of your module (they should appear with expand indicator, if they not select them, right click and select “Add as Library…” from the dropdown context menu). Confirm jar are added to the dependencies  (I see that you say that they are added). Save the changes. So now try to run your project in emulator instead of devise (this should perform AS to clean and complete the task). So now the emulator should works and display your application and you should be able to change running device to your real device. Other option is:

     

    • Download the library.jar file and copy it to      your /libs/ folder inside your application project.
    • Open the build.gradle file and edit your      dependencies to include the new .jar file:

    compile 'com.android.support:support-v4:13.0.+'
    compile files('libs/common.jar')
    compile files('libs/datachart.jar')

    • File -> Close Project
    • Open a command prompt on your project's root      location, i.e 'C:\Users\Username\AndroidStudioProjects\MyApplicationProject\'
    • On the command prompt, type gradlew clean, wait till it's done.
    • Reopen your application project in Android      Studio.
    • Test run your application and it should work      succesfully.

    I hope that this will helps you.