Punya built from sources error

Hi guys, I'm new to appinventor and I'm trying to develop some components using Punya built from sources. I followed the guide and successfully setup the vagrant VM.
The problem is that I added my component to the sources and the building process was ok, now I have just deleted one method from the Java class of my component and I'm not able to build successfully again. I'm getting the following error:

BUILD FAILED
/vagrant/appinventor/build.xml:21: The following error occurred while executing this line:
/vagrant/appinventor/buildserver/build.xml:195: Java returned: 1

What's wrong with it? Nothing has changed significantly since my last building process.
In addition to this I sometimes get the following error and I have to comment the relative lines each time:

AiClientLib:
   [depend] Deleted 14 out of date files in 36 seconds
    [javac] Compiling 13 source files to /vagrant/appinventor/appengine/build/war/WEB-INF/classes
    [javac] /vagrant/appinventor/build/components/ComponentTranslation/src/com/google/appinventor/client/AutogeneratedOdeMessages.java:13781: error: method nameParams() is already defined in interface AutogeneratedOdeMessages
    [javac]   String nameParams();
    [javac]          ^
    [javac]     /vagrant/appinventor/build/components/ComponentTranslation/src/com/google/appinventor/client/AutogeneratedOdeMessages.java:14257: error: method titleParams() is already defined in interface AutogeneratedOdeMessages
        [javac]   String titleParams();
        [javac]          ^
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] 2 errors

    BUILD FAILED
    /vagrant/appinventor/build.xml:16: The following error occurred while executing this line:
    /vagrant/appinventor/appengine/build.xml:545: The following error occurred while executing this line:
    /vagrant/appinventor/build-common.xml:125: Compile failed; see the compiler error output for details.

Thanks a lot in advance for your help

Is this a fresh copy?


Are you trying to compile only the components or the complete sources?

Hi, this is the output of the complete sources' compiling phase

The issue here is likely that you're not using the correct version of Java. You need Java 8

1 Like

Ok, but why did I get the first build succesfully completed? The first was ok and then I started getting errors

Look at the OdeMessages.java file and entry for these two strings nameParams(), titleParams() you can find other entries there so you can figure out how to add new entries for these two.

BTW one question from my side have you edited source code before compilation?

1 Like

@preetvadaliya yes, I first added a new Java class to the sources and I got "BUILD SUCCESSFUL". Then, when I simply removed some methods I started getting "BUILD FAILED"

Do this it will solve your problem.

1 Like

This may help you to understand ant task summary.

1 Like

@dora_paz I'm using Java 8 but still getting BUILD FAILED. Don't know what is wrong

When trying to build Punya from sources I get the following error:

[java] Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/slf4j/impl/AndroidLoggerFactory;
     [java] 2 errors; aborting
     [java] Dec 10, 2021 10:27:11 AM com.google.appinventor.buildserver.Compiler setProgress
     [java] INFO: The current progress is 75%
     [java] Dec 10, 2021 10:27:11 AM com.google.appinventor.buildserver.Compiler runMultidex
     [java] INFO: DX time: 151.772000 seconds
     [java] Dec 10, 2021 10:27:11 AM com.google.appinventor.buildserver.Compiler runMultidex
     [java] WARNING: YAIL compiler - DX execution failed.

BUILD FAILED
/vagrant/appinventor/build.xml:21: The following error occurred while executing this line:
/vagrant/appinventor/buildserver/build.xml:195: Java returned: 1

I added some libraries to components/build.xml file
<copy toFile="${public.deps.dir}/slf4j-android-1.7.30.jar" file="${lib.dir}/slf4j-android/slf4j-android-1.7.30.jar" />
and a Java class to source codes but the first time I was able to compile successfully, after that I only get BUILD ERROR. Please help

Why are you using Punya? As far as I know it is very outdated and not maintained. Instead you could build from regular App Inventor sources, depending on what you want to do.

image

Punya is not that old. It is still been worked on.

1 Like

Ok, I stand corrected. Apparently it has been resurrected again.
However, that does not answer the question why Altus is trying to compile its sources, instead of developing an app on top of it, and why he is asking questions in our forum instead of contacting the Punya people.

If you're adding new libraries, make sure to remove any old versions as this error indicates there are two or more copies of the given class in the dependencies list. If you have done this after previously running ant, you will need to ant clean to remove old versions of the dependencies from the build tree.

I'm responsible for the long term maintenance of Punya, so either way it ends up in my inbox.

1 Like

I found the entries but I don't know what to do to avoid this problem...

The AutogeneratedOdeMessages class is produced as part of the compilation of the AndroidRuntime target. The annotation processor that produces this file should be aggregating all of the methods together so that no duplicates originate. Somehow, the changes you've applied to Punya seem to be breaking this.