but not fix
show error
Exception in thread “main” java.lang.NullPointerException
│ at java.io.StringReader.(StringReader.java:50)
│ at shaded.org.json.JSONTokener.(JSONTokener.java:94)
│ at shaded.org.json.JSONArray.(JSONArray.java:162)
│ at io.shreyash.rush.ExtensionGenerator.main(ExtensionGenerator.java:50)
│ Picked up _JAVA_OPTIONS: -Xmx1024m
Did your try building with the -r
flag?
$ rush -r
__
_______ / /
/ / / / / / __
/ / / // ( / / / /
// _,/// //
A new and improved way of building App Inventor 2 extensions.
Usage:
rush [command]
Global options:
-h, --help Prints usage information.
Available commands:
build Identifies and builds the extension project in current working directory.
create Scaffolds a new extension project in current working directory
It should be:
$ rush build -r
used rush-win64.zip
$ rush build -r
__
_______ / /
/ / / / / / __
/ / / // ( / / / /
// _,/// //
• Build initialized
┌ Validating project files
│
│ OKAY Metadata file (rush.yml)
│
│ OKAY AndroidManifest.xml file
└ Done
┌ Compiling Java files
└ Done
┌ Processing extension files
│ ERR Exception in thread “main” java.lang.NullPointerException
│ at java.io.StringReader.(StringReader.java:50)
│ at shaded.org.json.JSONTokener.(JSONTokener.java:94)
│ at shaded.org.json.JSONArray.(JSONArray.java:162)
│ at io.shreyash.rush.ExtensionGenerator.main(ExtensionGenerator.java:50)
│ Picked up _JAVA_OPTIONS: -Xmx1024m
└ Failed
• Build failed
Can you remove the _JAVA_OPTIONS
path variable and try building again?
EDIT: @appmake, also don’t forget to restart your terminal app after you update the path variable.
rush build -r
__
_______ / /
/ / / / / / __
/ / / // ( / / / /
// _,/// //
• Build initialized
┌ Validating project files
│
│ OKAY Metadata file (rush.yml)
│
│ OKAY AndroidManifest.xml file
└ Done
┌ Compiling Java files
└ Done
┌ Processing extension files
│ ERR Exception in thread “main” java.lang.NullPointerException
│ at java.io.StringReader.(StringReader.java:50)
│ at shaded.org.json.JSONTokener.(JSONTokener.java:94)
│ at shaded.org.json.JSONArray.(JSONArray.java:162)
│ at io.shreyash.rush.ExtensionGenerator.main(ExtensionGenerator.java:50)
│ Picked up _JAVA_OPTIONS: -Xmx1024m
└ Failed
• Build failed
@appmake If your extension java file is empty (has no events or methods, view the example following the image) then you will get the error you’re getting…
Example of “empty” java file
package io.test.exampleextension;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
public class ExampleExtension extends AndroidNonvisibleComponent {
public ExampleExtension(ComponentContainer container) {
super(container.$form());
}
}
@Shreyash I recommend not telling people to add the useless JAVA_HOME to their Environment Variables, it is not needed and Rush works fine without it (even java -version does)… Not an error in sight, try it yourself. Only some programs like Apache Tomcat needs this to work properly.
Yeah, ikr? I ask them to add it just because for some people, who were facing issues like extension not being produced, etc, adding it (the JAVA_HOME env var) solved the issue.
Sure it solves the issue, but I’ve never added JAVA_HOME and it was perfectly fine, my extensions are compiled perfectly fine.
Maybe it’s added automatically or you’ve added it before
Its never been added and isn’t being added automatically.
It’s not related to Rush. You’re missing one or more curly brackets }
.
As @Xoma, you’re probably missing a curly brace somewhere, and hence, the error. Also, you should always re-verify any chunk of code you get from the internet. Usually chances are that you didn’t copied it correctly or the code itself isn’t valid.
Please someone make a small tutorial video of making a very simple extension on youtube
P.S. from the tutorial, you don’t need to join “their” Telegram group or download the Uido application from the Google Play Store. They’re not required steps.
Shreyash, in future, will we be able to create extension is other languages if possible