Hi everybody,
in the extension that I am developing I need to use ArrayUtils.addAll
In the appinventor/lib/commons-lang3 I saw that there is commons-lang3-3.10.jar
So in the build.xml file I added:
libraryjar file="${public.deps.dir}/commons-lang3-3.10.jar" /
copy toFile="${public.deps.dir}/commons-lang3.jar" file="${lib.dir}/commons-lang3/commons-lang3-3.10.jar" /
and in my extension I added
import org.apache.commons.lang3.ArrayUtils;
I can compile the extension
but when I run the project I have this error:
Failed resolution of: Lorg/apache/commons/lang3/ArrayUtils
What I missed?
Can You help me
Thank You
Marco
You should remove dir name from toFile attribute.
Hi vknow360,
thank You for your help.
Do You mean I should write
copy toFile="commons-lang3.jar" file="${lib.dir}/commons-lang3/commons-lang3-3.10.jar"
because I tried but I have error when I compile the extensions
error: package org.apache.commons.lang3 does not exist
Any other tips?
Thank You
Best Regards
Marco
So, have you added commons lang3 jar in /lib/commons-lang3 dir?
It is there.
You should write commons-lang3-3.10.jar
Also,have you specified this jar in your extension using UsesLibraries annotation?
1 Like
Hi Sunny Gupta,
thanks for your help, unfortunately your tip does not work.
In these days a read many topic about add libraries on extension,
es. How to add external libraries
Step 1,2,3 the library commons-lang3-3.10.jar is already in the appinventor-sources/appinventor/lib
Step 4 in the file components\build.xml i added copy toFile="${public.deps.dir}/commons-lang3.jar" file="${lib.dir}/commons-lang3/commons-lang3-3.10.jar"
Step 5 in my extension I added @UsesLibraries(libraries = "commons-lang3.jar")
When I compile i have this PARSE error
unjarExtensionLibraries:
[unzip] Expanding: C:\ai\appinventor\components\build\externalComponents-class\mifare.info\commons-lang3.jar into C:\ai\appinventor\components\build\externalComponents-class\mifare.info
jarAllExtensions:
jarExtension:
[jar] Building jar: C:\ai\appinventor\components\build\externalComponents-class\mifare.info.jar
ProGuard:
[copy] Copying 1 file to C:\ai\appinventor\components\build\externalComponents\mifare.info\files
[echo] Generated build file AndroidRuntime.jar [mifare.info]
dexAllExtensions:
dexExtension:
[java]
[java] PARSE ERROR:
[java] InvokeDynamic not supported
[java] ...while preparsing cst 0035 at offset 000000d2
[java] ...while parsing org/apache/commons/lang3/ArchUtils.class
[java] 1 error; aborting
[java] Picked up _JAVA_OPTIONS: -Xmx1024M
BUILD FAILED
C:\ai\appinventor\build.xml:46: The following error occurred while executing this line:
C:\ai\appinventor\components\build.xml:463: The following error occurred while executing this line:
C:\ai\appinventor\components\build.xml:476: Java returned: 1
I don't know how to solve
Best Regards
Marco
It is a very rare error faced by extension developers.
It means that the lib you want to use has at least one lambda uses.
Simplest solution is to use an older version of lib.
Very strange this is the library already present in the AppInventor Source
I will try to use an older lib, but should be nice to know why this library is present and how to use it
Thanks again Sunny Gupta
Best Regards
Marco
1 Like
Hi Sunny Gupta,
you solved my problem.
I used common-lang-2.6.jar and I successfully compiled the extension and I solved the error in the subject of this topic too.
Thank You very much
Best Regards
Marco.
1 Like