How to Convert This Java Into Extension

The Result Is

Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml

extensions:

clean:

init:

common_CommonUtils:

init:

CommonUtils:

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

CopyToRunLibDir:

components_AndroidRuntime:

init:
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/build/components
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes
    [
init:

CommonConstants:
    [javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

HtmlEntities:
    [javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning
      [jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/components/build/HtmlEntities.jar

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:21: error: cannot find symbol
    [javac] public Activity activity;
    [javac]        ^
    [javac]   symbol:   class Activity
    [javac]   location: class GetData
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:24: error: cannot find symbol
    [javac]     activity = (Activity)container.$context();
    [javac]                 ^
    [javac]   symbol:   class Activity
    [javac]   location: class GetData
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:37: error: variable url is already defined in method performRequest(String)
    [javac] URL url = new URL(url);
    [javac]     ^
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:24: error: cannot find symbol
    [javac]     activity = (Activity)container.$context();
    [javac]                 ^
    [javac]   symbol:   class Activity
    [javac]   location: class GetData
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:37: error: variable url is already defined in method performRequest(String)
    [javac] URL url = new URL(url);
    [javac]     ^
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:37: error: incompatible types: URL cannot be converted to String
    [javac] URL url = new URL(url);
    [javac]                   ^
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/baalveer78692/GetData/GetData.java:55: error: cannot find symbol
    [javac] BufferedReader bufferedReader = null;
    [javac] ^
    [javac]   symbol:   class BufferedReader
    [javac]   location: class GetData
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    [javac] 7 errors
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    [javac] 7 errors
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 7 seconds

Some imports are missing and there are some commons mistakes in variables.

Are u using ai2 sources

I Am Using https://editor.appybuilder.com/

Use extension template to compile

Any Solution Found ?

I have updated my post for now.
But I recommend you to use a Java IDE like Intelij IDEA.
Also I suggest everyone to ask extension related questions in AI2 community.

1 Like

Not Working