import io.deps.Currency;
//@UsesLibraries(libraries = "Currency.jar")
@DesignerComponent(
version = 1,
description = "Extension to assist financial and statistical calculations",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png"
)
@SimpleObject(external = true)
public class FinancialCalculator extends AndroidNonvisibleComponent {
public FinancialCalculator(ComponentContainer container) {
super(container.$form());
}
@SimpleFunction(description = "Format an integer as Brazilian currency")
public String FormatCurrency(int amount, @Options(Currency.class) final String currencyCode) {
I created the Currency class (Currency.java) that works with financial calculations. I'm having trouble importing the Currency class correctly into the main FinancialCalculator.java file. Please help me!
Show your Package declaration and write where the Currency class is located. Ok, I see that the Currency class is a helpers class. This class should be placed in the "helpers" folder, this folder should be in the same place as the main class of your extension.
If the Package for your extension is "io.deps", then the import for Currency should then look like this:
"io.deps.helpers.Currency"
You need to download the JAR library, place it in the "deps" folder, and then use the annotations in the extension: @UsesLibraries(libraries = "class.jar")
AndroidRuntime:
[mkdir] Created dir: /home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] Compiling 366 source files to /home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 7
[javac] Note: Wrote file file:///home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime/simple_components.json
[javac] Note: Wrote file file:///home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime/simple_components.txt
[javac] Note: Wrote file file:///home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime/simple_components_build_info.json
[javac] Note: Wrote file file:///home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime/AutogeneratedOdeMessages.java
[javac] Note: Wrote file file:///home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build/classes/AndroidRuntime/ComponentsTranslation.java
[javac] /home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/src/io/kodular/FinancialCalculator.java:38: error: package org.apache.commons.math3.distribution does not exist
[javac] import org.apache.commons.math3.distribution.NormalDistribution;
[javac] ^
[javac] /home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/src/io/kodular/FinancialCalculator.java:39: error: package org.apache.commons.math3.distribution does not exist
[javac] import org.apache.commons.math3.distribution.ExponentialDistribution;
[javac] ^
[javac] /home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/src/io/kodular/FinancialCalculator.java:40: error: package org.apache.commons.math3.distribution does not exist
[javac] import org.apache.commons.math3.distribution.PoissonDistribution;
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 errors
[javac] 1 warning
BUILD FAILED
/home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/build.xml:73: The following error occurred while executing this line:
/home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/components/build.xml:228: The following error occurred while executing this line:
/home/iaiaia/Documentos/Kodular/CriarExtensoes/appinventor-sources/appinventor/build-common.xml:125: Compile failed; see the compiler error output for details.
import org.apache.commons.math3.distribution.NormalDistribution;
import org.apache.commons.math3.distribution.ExponentialDistribution;
import org.apache.commons.math3.distribution.PoissonDistribution;
@DesignerComponent(
version = 1,
description = "Extension to assist financial and statistical calculations",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png"
)
@UsesLibraries(libraries = "commons-math3-3.4.jar")
@SimpleObject(external = true)
public class FinancialCalculator extends AndroidNonvisibleComponent {