Error While using libraries for extension!

237 views
Skip to first unread message

Ashutosh Sharma

unread,
Apr 8, 2018, 7:52:30 AM4/8/18
to App Inventor Open Source Development
I have built an extension that uses the tourguide library by worker8 and I have managed to get the aar file. I followed these instructions:
Extracted classes.jar from aar file and renamed classes.jar to the name of aar file with extension .jar
Deleted the classes.jar file from the aar file
copied the aar and jar file to appinventor/lib/tourguide
made a pathelement entry in components/build.xml for jar file
made a copy entry in buildserver/build.xml for both aar and jar files
@UsesLibraries(libraries = "tourguide-1.0.19-20180314.161558-1.aar,"+"tourguide-1.0.19-20180314.161558-1.jar")
and implemented the extension
the build was successful
But when I import the extension in appinventor and connect it to companion I get error: java.lang.NoClassDefFoundError: Failed resolution of:
Can anyone please help me??
-Ashutosh

Taifun

unread,
Apr 8, 2018, 10:50:05 AM4/8/18
to App Inventor Open Source Development
@UsesLibraries(libraries = "tourguide-1.0.19-20180314.161558-1.aar,"+"tourguide-1.0.19-20180314.161558-1.jar")

why is there a + sign?
correct would be something like this (libarries comma separated...
@UsesLibraries(libraries = "play-services-auth-9.6.1.jar, play-services-auth-base-9.6.1.jar")

example taken from https://puravidaapps.com/accountmanager.php
Taifun

Ashutosh Sharma

unread,
Apr 8, 2018, 11:31:17 AM4/8/18
to App Inventor Open Source Development
I guess it is the same because + is used to join 2 strings.

Taifun

unread,
Apr 8, 2018, 2:40:33 PM4/8/18
to App Inventor Open Source Development
sorry, you are correct
but why do you need the library twice? just import only the jar file...
Taifun

Ashutosh Sharma

unread,
Apr 9, 2018, 12:03:10 AM4/9/18
to App Inventor Open Source Development
jar files contain only the java classes and aar contains the resources. The library i'm trying to use (TourGuide) also has resources such as layout etc. I guess the problem is that I am not able to include resources as well as the dependencies.

Ashutosh Sharma

unread,
Apr 9, 2018, 1:10:32 AM4/9/18
to App Inventor Open Source Development
I changed my library and I am using amlcurran library but still I am getting the error

Failed resolution of: Lcom/github/amlcurran/showcaseview/R$styleable;

Taifun

unread,
Apr 9, 2018, 10:07:09 AM4/9/18
to App Inventor Open Source Development

Ashutosh Sharma

unread,
Apr 9, 2018, 10:28:46 AM4/9/18
to App Inventor Open Source Development
I did exactly what is mentioned there but it is not working

Evan Patton

unread,
Apr 9, 2018, 11:49:47 AM4/9/18
to App Inventor Open Source Development
Resources in AAR libraries aren't supported yet in extensions, just in App Inventor core. We will need to release an update to the extension system to support inclusion of additional resources before this will work.

Evan

Shivendra Kr. Sahu

unread,
Apr 9, 2018, 1:57:14 PM4/9/18
to App Inventor Open Source Development
Then you should tell how to change the AAR file into jar.
???

Ashutosh Sharma

unread,
Apr 9, 2018, 2:03:40 PM4/9/18
to App Inventor Open Source Development
But on the post of Red Panda you have taught to use aar for extension doesn't that work?

Evan Patton

unread,
Apr 10, 2018, 2:31:49 PM4/10/18
to App Inventor Open Source Development
It only works under specific circumstances. The problem is that the generation of the extension occurs in the components portion of the code base, but R class generation is done at runtime in the buildserver. Because of this, your extension will not include the R class file for the AAR. If the JAR file references the R class, then you will get the NoClassDefFoundError. This is why it isn't working in your case. Other AAR files, which don't include R definitions, will work fine. It all depends on how the library is constructed.

Evan
Reply all
Reply to author
Forward
0 new messages