Third-party libraries


It says that it created a directory.
However, if I go there:

Where did it save the extension?

following the tutorial, it should also say building zip (it doesn’t) any idea why?

Make sure you have @SimpleObject(external=true) defined in your extension’s source file. It is necessary in order to get the .aix file.

Same result.

Source

package net.ontstd.TwilioSMS;

import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.;
import com.google.appinventor.components.runtime.
;
import com.google.appinventor.components.common.ComponentCategory;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;

@SimpleObject(external=true)

@DesignerComponent(version = 1, description = “Twilio SEND SMS Extension by ONT Studios.
” +
“Create your own here:
https://editor.appybuilder.com
”,
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = “http://appyBuilder.com/extensions/icons/extension.png”)
@SimpleObject(external = true)
public class TwilioSMS extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public TwilioSMS(ComponentContainer container) {
super(container.$form());
this.container = container;
}

@SimpleFunction(description = "Authenticates the API (use obfuscated text)")
public Authenticate StoreValue(final String AccountSID, final String AuthToken) {
    Twilio.init(AccountSID, AuthToken);
}

@SimpleFunction(description = "Sends SMS and returnes the code (500=OK, 400=Invalid PhoneNumber, 300=Wrong Credentials, 200=Internal Error)")
public Object GetValue(final String ToPhoneNumber, final String FromPhoneNumber, final String Message) {
    TinyDB tinyDB = new TinyDB(container);
    return 500;
}

}

You’ve two @SimpleObject annotations.

Also, AFAIK, you can’t return Authenticate.

1 Like

There are several errors in your code. Yet the compiler doesn’t seem to mind… My hunch is your code isn’t being compiled at all. You might’ve put it in a directory ant cannot see

3 Likes

Same thing for a working example (that can compile in the AppyBuilder IDE)

EDIT: Forgot to mention, also doesn’t work when I add a package name.

Source

/** ~~~~~

  • Created with the AppyBuilder Code Editor.
  • This is a template for basic Extension.
  • Modify this template to customize your extension.
  • **** NOTE: DO NOT use a package name.
  • **** The package name will be created for you automatically.
  • **** Adding a package name will cause a compile error
    /
    import android.content.Context;
    import android.util.Log;
    import com.google.appinventor.components.annotations.
    ;
    import com.google.appinventor.components.runtime.*;
    import com.google.appinventor.components.common.ComponentCategory;

@DesignerComponent(version = 1, description = “This Extension was created with the AppyBuilder Code Editor.
” +
“Create your own here:
https://editor.appybuilder.com
”,
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = “http://appyBuilder.com/extensions/icons/extension.png”)
@SimpleObject(external = true)
public class Test1 extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public Test1(ComponentContainer container) {
super(container.$form());
this.container = container;
}

@SimpleEvent(description = "")
	public void GotAppleCount(int count) {
	EventDispatcher.dispatchEvent(this, "GotAppleCount", count);
}

}

I have checked all my environment variables and they seem to be working fine :man_shrugging:
@Vishwas, is there a possibility my compiler is broken?
Also,

How could I check that?

I think java file should be in \appinventor-sources-master\appinventor\components\src\com\google\appinventor directory.
And this is the reason why compiler is not showing errors because ant is not able to see your extension.

AFAIK, such folder doesn’t exists in the source. :thinking:
BTW @Mateja, can you please try to build the extension with the extension template repository?

Actually I have extracted zip file I to appinventor-sources-master directory :sweat_smile:

I think @Mateja is not willing to do that.

I’m gonna do whatever it takes to make it work :slight_smile:


Am I supposed to GitBash here in D:\extension-template-master (my case)

Yes. And you’ll find the generated extension in the out folder.

Worked like a charm! Thanks. <3

I want to learn the work of Extensions

See this:

Hi, it worked for a week and now it’s showing me this:

Error
dexAllExtensions:

dexExtension:
     [java] Picked up _JAVA_OPTIONS: -Xmx1024m
     [echo] Dexing extension: net.ontstd.isempty

dexExtension:
     [java] Picked up _JAVA_OPTIONS: -Xmx1024m
     [echo] Dexing extension: net.ontstd.test

dexExtension:
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.DataHandler$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.SecuritySupport$2) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.SecuritySupport$3) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.SecuritySupport$5) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.SecuritySupport$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                                    s
     [java] (javax.activation.SecuritySupport$4) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                                    ed by a
     [java] compiler that did not target the modern .class file format. The reco                                    mmended
     [java] solution is to recompile the class from source, using an up-to-date                                     compiler
     [java] and without specifying any "-target" type options. The consequence o                                    f ignoring
     [java] this warning is that reflective operations on this class will incorr                                    ectly
     [java] indicate that it is *not* an inner class.
     [java]
     [java] trouble processing "javax/xml/bind/Binder.class":
     [java]
     [java] Ill-advised or mistaken usage of a core class (java.* or javax.*)
     [java] when not building a core library.
     [java]
     [java] This is often due to inadvertently including a core library file
     [java] in your application's project, when using an IDE (such as
     [java] Eclipse). If you are sure you're not intentionally defining a
     [java] core class, then this is the most likely explanation of what's
     [java] going on.
     [java]
     [java] However, you might actually be trying to define a class in a core
     [java] namespace, the source of which you may have taken, for example,
     [java] from a non-Android virtual machine project. This will most
     [java] assuredly not work. At a minimum, it jeopardizes the
     [java] compatibility of your app with future versions of the platform.
     [java] It is also often of questionable legality.
     [java]
     [java] If you really intend to build a core library -- which is only
     [java] appropriate as part of creating a full virtual machine
     [java] distribution, as opposed to compiling an application -- then use
     [java] the "--core-library" option to suppress this error message.
     [java]
     [java] If you go ahead and use "--core-library" but are in fact
     [java] building an application, then be forewarned that your application
     [java] will still fail to build or run, at some point. Please be
     [java] prepared for angry customers who find, for example, that your
     [java] application ceases to function once they upgrade their operating
     [java] system. You will be to blame for this problem.
     [java]
     [java] If you are legitimately using some code that happens to be in a
     [java] core package, then the easiest safe alternative you have is to
     [java] repackage that code. That is, move the classes in question into
     [java] your own package namespace. This means that they will never be in
     [java] conflict with core system classes. JarJar is a tool that may help
     [java] you in this endeavor. If you find that you cannot do this, then
     [java] that is an indication that the path you are on will ultimately
     [java] lead to pain, suffering, grief, and lamentation.
     [java]
     [java] 1 error; aborting
     [java] Picked up _JAVA_OPTIONS: -Xmx1024m

It compiled fine in the AppyBuilder IDE.

What are you using, AI2 sources or the extension template? Have you changed anything in the source, especially the build.xml file? Also, can you please post the full error log?

Hi, no I haven’t changed anything. I am using this:

The full log

ONT Studios@DESKTOP-6N3MPVL MINGW64 /d/extension-template (master)
$ ant extensions
Buildfile: D:\extension-template\build.xml

javac:
    [javac] Compiling 2 source files to D:\extension-template\build\classes
    [javac] warning: [options] bootstrap class path not set in conjunction with                       -source 1.7
    [javac] Note: Wrote file file:/D:/extension-template/build/classes/simple_co                      mponents.json
    [javac] Note: Wrote file file:/D:/extension-template/build/classes/simple_co                      mponents.txt
    [javac] Note: Wrote file file:/D:/extension-template/build/classes/simple_co                      mponents_build_info.json
    [javac] Note: Wrote file file:/D:/extension-template/build/classes/Autogener                      atedOdeMessages.java
    [javac] Note: Wrote file file:/D:/extension-template/build/classes/Component                      sTranslation.java

process:
     [java]
     [java] Extensions : Generating extensions
     [java]
     [java] Extensions : Generating files [net.ontstd.TwilioSMS]
     [java] Extensions : Copying file net\ontstd\TwilioSMS\TwilioSMS.class
     [java] Extensions : Successfully created net.ontstd.TwilioSMS build info fi                      le
     [java] Extensions : Successfully created net.ontstd.TwilioSMS extension pro                      perties file
     [java]
     [java] Extensions : Generating files [net.ontstd.search]
     [java] Extensions : Copying file net\ontstd\search\Search.class
     [java] Extensions : Successfully created net.ontstd.search build info file
     [java] Extensions : Successfully created net.ontstd.search extension proper                      ties file

unjarAllExtensionLibraries:

unjarExtensionLibraries:
    [unzip] Expanding: D:\extension-template\build\externalComponents-classes\ne                      t.ontstd.TwilioSMS\Twilio.jar into D:\extension-template\build\externalComponent                      s-classes\net.ontstd.TwilioSMS

unjarExtensionLibraries:

jarAllExtensions:

jarExtension:
      [jar] Building jar: D:\extension-template\build\externalComponents-classes                      \net.ontstd.TwilioSMS.jar

ProGuard:
     [copy] Copying 1 file to D:\extension-template\build\externalComponents\net                      .ontstd.TwilioSMS\files
     [echo] Generated build file AndroidRuntime.jar [net.ontstd.TwilioSMS]

jarExtension:
      [jar] Building jar: D:\extension-template\build\externalComponents-classes                      \net.ontstd.search.jar

ProGuard:
     [copy] Copying 1 file to D:\extension-template\build\externalComponents\net                      .ontstd.search\files
     [echo] Generated build file AndroidRuntime.jar [net.ontstd.search]

dexAllExtensions:

dexExtension:
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.DataHandler$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.SecuritySupport$2) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.SecuritySupport$3) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.SecuritySupport$5) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.SecuritySupport$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner clas                      s
     [java] (javax.activation.SecuritySupport$4) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produc                      ed by a
     [java] compiler that did not target the modern .class file format. The reco                      mmended
     [java] solution is to recompile the class from source, using an up-to-date                       compiler
     [java] and without specifying any "-target" type options. The consequence o                      f ignoring
     [java] this warning is that reflective operations on this class will incorr                      ectly
     [java] indicate that it is *not* an inner class.
     [java]
     [java] trouble processing "javax/xml/bind/Binder.class":
     [java]
     [java] Ill-advised or mistaken usage of a core class (java.* or javax.*)
     [java] when not building a core library.
     [java]
     [java] This is often due to inadvertently including a core library file
     [java] in your application's project, when using an IDE (such as
     [java] Eclipse). If you are sure you're not intentionally defining a
     [java] core class, then this is the most likely explanation of what's
     [java] going on.
     [java]
     [java] However, you might actually be trying to define a class in a core
     [java] namespace, the source of which you may have taken, for example,
     [java] from a non-Android virtual machine project. This will most
     [java] assuredly not work. At a minimum, it jeopardizes the
     [java] compatibility of your app with future versions of the platform.
     [java] It is also often of questionable legality.
     [java]
     [java] If you really intend to build a core library -- which is only
     [java] appropriate as part of creating a full virtual machine
     [java] distribution, as opposed to compiling an application -- then use
     [java] the "--core-library" option to suppress this error message.
     [java]
     [java] If you go ahead and use "--core-library" but are in fact
     [java] building an application, then be forewarned that your application
     [java] will still fail to build or run, at some point. Please be
     [java] prepared for angry customers who find, for example, that your
     [java] application ceases to function once they upgrade their operating
     [java] system. You will be to blame for this problem.
     [java]
     [java] If you are legitimately using some code that happens to be in a
     [java] core package, then the easiest safe alternative you have is to
     [java] repackage that code. That is, move the classes in question into
     [java] your own package namespace. This means that they will never be in
     [java] conflict with core system classes. JarJar is a tool that may help
     [java] you in this endeavor. If you find that you cannot do this, then
     [java] that is an indication that the path you are on will ultimately
     [java] lead to pain, suffering, grief, and lamentation.
     [java]
     [java] 1 error; aborting
     [java] Picked up _JAVA_OPTIONS: -Xmx1024m

BUILD FAILED
D:\extension-template\build.xml:116: The following error occurred while executin                      g this line:
D:\extension-template\build.xml:129: Java returned: 1

Total time: 1 minute 10 seconds
Picked up _JAVA_OPTIONS: -Xmx1024m