Help getting started with extension development

Besides not having had much contact with Java, I haven’t programmed in Java for years.
But I program in several languages and it is just a matter of practicing.
I am not just waiting for an answer from you, I am analyzing several extension codes, mainly the AppInventor source code, and what I have found is this:
@UsesLibraries(libraries = “json.jar”)
But this causes an error when compiling Rush.
Also, testing how an extension works is extremely annoying, so I’m turning to you, otherwise I wouldn’t be bothering you.

That annotation doesn’t exists in Rush, and that’s the reason behind errors. Instead, you need to declare any external dependency of your extension in rush.yml as stated previously by others.

As you mentioned you’re new to Java, I’d like to recommend you to use either IntelliJ IDEA or Android Studio as an IDE. Although VS Code is great for almost every other language and framework out there, it doesn’t quite play well with Java (and so with Rush).

Using either of the above mentioned IDEs will also help solve your confusion around import statements as they are able to auto-import required classes as you write your code.

4 Likes

And did you practiced??

Several programmers including me also used to ask different questions without realizing how actually java works… I’ve made my first extension and had published it when i even don’t know different small things of java … I didn’t know about Arrays , neither Methods , Interface or anythings… After realizing things , I then patiencly and slowly learned and still learning things…
importing any classes is the basic of java …in every programs, required imports are necessary …

Of course, so the developers had replied you with such answers:

And for imports ,

And you are still asking ,

So why i asked you

and said you how imports are done …


Thanks a lot, I’ll download IntelliJ IDEA, VSCode is showing many errors in the code, which is also disturbing a lot. I had already understood that it was some difficulty to analyze the project and Rush doesn’t identify some annotations.

1 Like

@laboratoriodosfundos I hope you are well,

Here we mean like if I use a library named rx.jar, then I need to import its classes, A jar is a bundle of classes

So, as I said, for an example, I used a jar named rx.jar, so I will need to add these in imports

import rx.android.plugins.*;

import rx.android.schedulers.*;

import rx.android.*;

import rx.functions.Action1;

import rx.android.schedulers.AndroidSchedulers;

import rx.functions.Action1;
1 Like

Hi, I used Aixc and Eclipse to build extension. You can read this with help of google translation.
https://www.kevinkun.cn/aixc.html

copy the jar file into lib folder, in Eclipse add it to build path, then the IDE will add the necessary import automatically.

don’t forget to add the @UsesLibaries annotation

2 Likes