Help in compiling extension with appybuilder :Errors in compiling extension,

projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/zchartsak/GetSourceWeb/GetSourceWeb.java:17: error: package java.net.http does not exist
[javac] import java.net.http.HttpClient;
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/zchartsak/GetSourceWeb/GetSourceWeb.java:18: error: package java.net.http does not exist
[javac] import java.net.http.HttpRequest;
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/zchartsak/GetSourceWeb/GetSourceWeb.java:19: error: package java.net.http does not exist
[javac] import java.net.http.HttpResponse;
[javac] ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/zchartsak/GetSourceWeb/GetSourceWeb.java:41: error: cannot find symbol
[javac] HttpClient client = HttpClient.newHttpClient();
[javac] ^
[javac] symbol: class HttpClient

The package is not present in appy builder code editor and you can not add external lib in appy builder.

You can try this with niotron ide or App Inventor extension template, etc .

1 Like

Also you can use rush.

These classes in java.net.http weren't added to the JDK until version 11, but Android still mostly supports Java 7 and 8. If you do end up getting implementations of those classes, you'll need to use jarjar to repackage them to something other than the top-level java namespace because the dex utility will reject them.

After instalation of rush
i tried to make "Your very first Rush project" in "Getting started"
Build initialized

┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling source files
│ info Picked 1 source file
└ failed

• Build failed [15ms] []
what is my mistake?

this question could better be solved by the developer of rush @shreyash

1 Like