This behaviour is inherited from App Inventor. You’re not allowed to use boxed types, such as Integer
, Boolean
, etc. You should instead use their primitive counterparts like int
, boolean
, etc.
I am not using such types on purpose. As you can see in the sample code, the specified return type is Int?
but if you check the compiled code, kotlin makes the return type Integer
unless you provide an alternate value using ?:
or some other way.
This should never happen unless the type of _currentPost.id
is Integer
. Make sure it is Int
.
I installed the rush and when I run it I get an error, why? This is the error:
bash: /data/data/com.termux/files/usr/bin/rush: Bad address
I also tried termux, but in my case the architecture of my device is aarch64 not x86_64, and when I install from github directly it just shows no such file or directory
.
I ended up trying to build rush myself, by downloading Dart SDK for arm64 and try to build it with the help the instructions. The binary of rush
is built successfully, and I can build extension smoothly.
Just one, big problem. When I upload the extension to Kodular / AI2, it gives me the error invalid stored block lengths
even when I build the template extension without editing. I have no idea why this happens though.
I have never tested Rush on Termux. Will try to do that today and see if I can reproduce the issue.
Why did this fail for no reason, im trying to compile a project from today morning, i solved few errors, but this is there.
It is very difficult to say what’s exactly wrong. Do you mind PMing this extension’s source so I can try building it on my PC?
I think I have solved it (temporarily maybe).
Whenever this error occurs, i have to delete the .rush directory and run with the -r flag, after that i have to run normal build and that comes fine, I will PM you the source.
Error (I did not change anything in the code)
PS C:\Users\mor\Desktop\project> rush create bbbb
__
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
? Organisation (package name) com.aaaa.bbbb
? Author bbbb
? Version name 1
? Language (Use arrow or w/s keys to navigate & press enter to select)
❯ Java
Kotlin
• Getting things ready...
• Success! Generated a new AI2 extension project in: C:\Users\mor\Desktop\project\bbbb
Next up,
- cd into bbbb/, and
- run rush build to compile your extension.
PS C:\Users\mor\Desktop\project> cd bbbb
PS C:\Users\mor\Desktop\project\bbbb> rush build
__
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
• Build initialized
┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 1 source file
└ done
┌ Processing the extension
│ info Linking extension assets
│ info Generating DEX bytecode
│ Compilation failed with an internal error.
│ java.lang.IllegalArgumentException: Unsupported class file major version 60
│ at com.android.tools.r8.A.a.a.f.<init>(:10)
│ at com.android.tools.r8.A.a.a.f.<init>(:2)
│ at com.android.tools.r8.A.a.a.f.<init>(:1)
│ at com.android.tools.r8.A.a.a.f.<init>(:107)
│ at com.android.tools.r8.graph.x0.a(:24)
│ at com.android.tools.r8.dex.a$a.a(:12)
│ at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(Unknown Source)
│ at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
│ at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
│ at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
│ at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
└ failed
• Build failed [4s 283ms] []
Kumaraswamy@DESKTOP-BD6HS68 MINGW64 ~/Documents/log/log (upstream/master)
$ rush build
__
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
• Build initialized
┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 4 source files
└ done
┌ Processing the extension
│ info Desugaring Java 8 language features
│ info Linking extension assets and dependencies
Unhandled exception:
FileSystemException: Cannot copy file to 'C:\Users\user\AppData\Roaming\rush\workspaces\xyz.kumaraswamy.log\art\com\google\devtools\build\android\desugar\runtime\ThrowableExtension$ReuseDesugaringStrategy.class'
, path = 'C:\Users\user\AppData\Roaming\rush\workspaces\xyz.kumaraswamy.log\classes\com\google\devtools\build\android\desugar\runtime\ThrowableExtension$ReuseDesugaringStrategy.class' (OS Error: Cannot create a
file when that file already exists.
, errno = 183)
#0 _File.throwIfError (dart:io/file_impl.dart:635)
#1 _File.copySync (dart:io/file_impl.dart:340)
#2 Generator._copyRequiredClasses.<anonymous closure> (package:rush_cli/commands/build_command/tools/generator.dart:156)
#3 Iterable.forEach (dart:core/iterable.dart:279)
#4 Generator._copyRequiredClasses (package:rush_cli/commands/build_command/tools/generator.dart:152)
#5 Generator.generate (package:rush_cli/commands/build_command/tools/generator.dart:22)
#6 BuildCommand._process (package:rush_cli/commands/build_command/build_command.dart:296)
<asynchronous suspension>
#7 BuildCommand._compile (package:rush_cli/commands/build_command/build_command.dart:256)
<asynchronous suspension>
#8 BuildCommand.run (package:rush_cli/commands/build_command/build_command.dart:203)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209)
<asynchronous suspension>
Kumaraswamy@DESKTOP-BD6HS68 MINGW64 ~/Documents/log/log (upstream/master)
Deleting the files it says already exists solves the problem.
Please create a new issue on Rush’s GitHub repo for this and the previous issue.
That is the same issue I was talking about, they both are the same.
Nope, they are different. The first one doesn’t give enough info about why the build is failing, whereas the latter is a file system error.
code:
package com.mordechay.mefateach.Keys;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailList;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.os.Handler;
import android.text.InputType;
import android.util.Log;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
public class Keys extends AndroidNonvisibleComponent {
int keyCode = 7;
public Keys(ComponentContainer container) {
super(container.$form());
}
@SimpleEvent(description = "key 1")
public void onKeyDown(int keyCode, KeyEvent event) {
boolean a;
if(keyCode == KeyEvent.KEYCODE_1){
a = true;
}
EventDispatcher.dispatchEvent(this, "onKeyDown", a);
}
}
error:
__
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
• Build initialized
┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 1 source file
│ warn Simple event "onKeyDown" should follow 'PascalCase' naming convention.
│ An annotation processor threw an uncaught exception.
│ Consult the following stack trace for details.
│ java.lang.IllegalStateException
│ at io.shreyash.rush.util.ConvertToYailTypeKt.convert(ConvertToYailType.kt:142)
│ at io.shreyash.rush.block.BlockWithParams.params(BlockWithParams.kt:16)
│ at io.shreyash.rush.block.Event.runChecks(Event.kt:31)
│ at io.shreyash.rush.block.Event.<init>(Event.kt:16)
│ at io.shreyash.rush.ExtensionProcessor.process(ExtensionProcessor.kt:60)
│ at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
│ at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
│ at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
│ at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
│ at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
│ at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
│ at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
│ at com.sun.tools.javac.main.Main.compile(Main.java:523)
│ at com.sun.tools.javac.main.Main.compile(Main.java:381)
│ at com.sun.tools.javac.main.Main.compile(Main.java:370)
│ at com.sun.tools.javac.main.Main.compile(Main.java:361)
│ at com.sun.tools.javac.Main.compile(Main.java:56)
│ at com.sun.tools.javac.Main.main(Main.java:42)
└ failed
• Build failed [2s 256ms] [1 warning]
why is it? How can this be arranged?
OnKeyDown
Interesting, didn’t know rush enforce naming conventions in methods.
But wouldn’t it be better if there’s a flag to ignore this? (although discouraged)
No, Rush doesn’t enforce naming conventions, it just warns you about them.
@mordechay, your build is failing because you are using an unsupported type as your simple function’s parameter type.
public void onKeyDown(int keyCode, KeyEvent event) {
^^^^^^^^
You can only use the following types as parameter or return types:
String
- Number types like
int
,float
,double
, etc. java.util.Calendar
boolean
- Classes of all the available AI2 components and other runtime classes, like
Button
,AndroidViewComponent
, etc. - Some other AI2 types like
YailList
,YailObject
andYailDictionary
. java.lang.Object
@Shreyash is there any possibility for multiple extensions in one aix any time soon?
For e.g. Custom ListView - ColinTreeListView * · Appinventor/Thunkable Extensions