How can I import a gwt library?

Hello, Good Morning sir @ewpatton

I want to know how to import a library(jar) in appinventor. I want to use material designs in appinventor using this library ?

https://mvnrepository.com/artifact/com.github.gwtmaterialdesign/gwt-material-addins/2.5.0

Is there any way to import this library with compile dependencies ?

Thanks

1 Like

We vendor any libraries we use for App Inventor under the lib directory and import them into the appropriate module(s) in App Inventor. You'll see there are already a few libraries related to GWT in that folder. You will have to do something similar if you want to import additional GWT libraries for the appengine module.

1 Like

I imported the library successfully, I want to create a Widget in xml(UiBinder). Then, access it through java code. like I want to create a HorizontalPanel in XML and access it from a java class to add elements inside it. Is it possible sir @ewpatton ?

Sir @ewpatton , while compiling the sources. I got this error.

Errors in 'com/allen_sauer/gwt/dnd/client/util/DOMUtil.java'
     [java]       [ERROR] Line 39: Rebind result 'com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl' cannot be abstract

I added this in my YaClient.gwt.xml to resolve this error but it didn't worked.

    <replace-with

class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImplOpera">
        <when-type-is 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl" />
        <when-property-is name="user.agent" value="opera" />
    </replace-with>

    <replace-with

class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImplSafari">
        <when-type-is 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl" />
        <when-property-is name="user.agent" value="safari" />
    </replace-with>

    <replace-with 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImplIE6">
        <when-type-is 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl" />
        <when-property-is name="user.agent" value="ie6" />
    </replace-with>

    <replace-with

class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImplMozilla">
        <when-type-is 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl" />
        <when-property-is name="user.agent" value="gecko1_8" />
    </replace-with>

    <replace-with

class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImplMozillaOld">
        <when-type-is 
class="com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl" />
        <when-property-is name="user.agent" value="gecko" />
    </replace-with>

Is there any way to fix this error ?

You shouldn't need to add a bunch of replace rules. Make sure that you're adding all of the necessary inherits tags, which should recursively pick up any replacement rules in the included modules.

I added only these two

  <inherits name="gwt.material.design.GwtMaterialDesign" />
  <inherits name="gwt.material.design.addins.GwtMaterialAddins" />

Did App Inventor build successfully before you added these libraries? I am a bit surprised that they would have such an adverse reaction with one of the other dependencies. Possibly try adding them before/after the inherts statement for the dnd library and see if it changes anything.

1 Like

Sir @ewpatton , I just tried it and it's giving other errors

     [java] Compiling module com.google.appinventor.YaClient-dev
     [java]    Ignored 2 units with compilation errors in first pass.
     [java] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
     [java]    Computing all possible rebind results for 'com.allen_sauer.gwt.dnd.client.util.DragClientBundle'
     [java]       Rebinding com.allen_sauer.gwt.dnd.client.util.DragClientBundle
     [java]          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
     [java]             Preparing method css
     [java]                [ERROR] Your ClientBundle is referencing css files instead of gss. You will need to either convert these files to gss using the converter tool or turn on auto convertion in your gwt.xml file. Note: Autoconversion will be removed in the next version of GWT, you will need to move to gss.Add this line to your gwt.xml file to temporary avoid this:<set-configuration-property name="CssResource.conversionMode"    value="strict" /> Details on how to migrate to GSS can be found at: http://goo.gl/tEQnmJ
     [java]    [ERROR] Errors in 'com/allen_sauer/gwt/dnd/client/util/DragClientBundle.java'
     [java]       [ERROR] Line 72: Failed to resolve 'com.allen_sauer.gwt.dnd.client.util.DragClientBundle' via deferred binding
     [java]    Computing all possible rebind results for 'com.google.appinventor.client.editor.youngandroid.BlocklyPanel.BlocklySource'
     [java]       Rebinding com.google.appinventor.client.editor.youngandroid.BlocklyPanel.BlocklySource
     [java]          Invoking generator com.google.gwt.query.rebind.JsniBundleGenerator
     [java]             JsniBundleGenerator - importing external javascript: com/google/appinventor/client/editor/youngandroid/blockly.js
     [java]    Computing all possible rebind results for 'com.google.appinventor.client.utils.HTML5DragDrop.HTML5DragDropSupport'
     [java]       Rebinding com.google.appinventor.client.utils.HTML5DragDrop.HTML5DragDropSupport
     [java]          Invoking generator com.google.gwt.query.rebind.JsniBundleGenerator
     [java]             JsniBundleGenerator - importing external javascript: com/google/appinventor/client/utils/html5dnd.js
     [java]    [ERROR] Errors in 'com/allen_sauer/gwt/dnd/client/util/DOMUtil.java'
     [java]       [ERROR] Line 39: Rebind result 'com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl' cannot be abstract
     [java]    Computing all possible rebind results for 'com.google.appinventor.client.explorer.dialogs.NoProjectDialogBox_NoProjectDialogBoxUiBinderImpl_GenBundle'
     [java]       Rebinding com.google.appinventor.client.explorer.dialogs.NoProjectDialogBox_NoProjectDialogBoxUiBinderImpl_GenBundle
     [java]          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
     [java]             Preparing method style
     [java]                [ERROR] Your ClientBundle is referencing css files instead of gss. You will need to either convert these files to gss using the converter tool or turn on auto convertion in your gwt.xml file. Note: Autoconversion will be removed in the next version of GWT, you will need to move to gss.Add this line to your gwt.xml file to temporary avoid this:<set-configuration-property name="CssResource.conversionMode"    value="strict" /> Details on how to migrate to GSS can be found at: http://goo.gl/tEQnmJ
     [java]    [ERROR] Errors in 'gen/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox_NoProjectDialogBoxUiBinderImpl.java'
     [java]       [ERROR] Line 138: Failed to resolve 'com.google.appinventor.client.explorer.dialogs.NoProjectDialogBox_NoProjectDialogBoxUiBinderImpl_GenBundle' via deferred binding

The error remains same if I put the inherit just before/after the dnd-library

Sir @ewpatton , Appinventor is successfully compiled when I removed inherits and path element from appengine/build.xml

Sir @ewpatton , I only added path element to build.xml and added inherit tags in YaClient.gwt.xml

Is something I missed ?

Unfortunately, I don't have the bandwidth right now to dig into this library. The fact that it seems to break multiple parts of the GWT compilation isn't great. What is the goal of integrating this library exactly?

I want to integrate material components but MDC is not that good. So, I am trying to import this library to create material widgets easily and good looking. Exactly, I want to make a Material Textbox..