MadWooookie
MadWooookie

Reputation: 11

Android import Apache Commons Math - Unable to use Normal Distribution

I've imported the Apache Common Math library to use normal distribution. But it isn't working. The error is that it cannot be accessed outside of the package.

I'm unable to import the normalDistributionCDFAlgorithm library.

public void calc1()
{
    if (normDist1.getText().toString().equals(""))
    {
        //do nothing
    }
    else
    {
        double mean = Double.parseDouble(meanTxt.toString());
        double standDevi = Double.parseDouble(standDeviTxt.toString());
        double userInput = Double.parseDouble(normDistTxt1.toString());
        double answer;

          NormalDistribution d ;

        if (tglbool1)
        {
            //> greater than
            d = new NormalDistribution(mean,standDevi);
            answer = d.cumulativeProbability(1000);

    }
}

Upvotes: 1

Views: 1680

Answers (1)

LBes
LBes

Reputation: 3456

I don't know about this library but I suspect you have not added the jar to your project. To do so you should:

  1. Place the jar file in the libs folder in the root of your module.
  2. Click on File -> Project Settings.
  3. On the left side choose the module you want to add the library to
  4. On the right side choose tab Dependencies
  5. In the bottom press Plus sign and click File dependency
  6. Finally choose the corresponding jar and sync the project

Edit: Turns out you can also do the following:

dependencies {
compile 'org.apache.commons:commons-math3:3.6.1'
}

Upvotes: 2

Related Questions