Help for Extension Building

I am a student and new to extension building. I am trying build an extension with the help of SDK documentations.

First of all It guides us to Import Gradle Dependency. How can I do that

Secondly, How can I define XML or basic design for my extension (such as width, height, etc.)

I am really looking forward for help

1 Like

First of I'd recommend to learn Java basics first before trying Android development or Extension development.

Here are some tips.
I would suggest to learn a few things.
Java and basics of Annotations and Classes before starting to develop more complex extensions..
for example start learning by creating extensions that uses Integers or Strings

For compiling am extension use extension-template or Appinventor sources or Rush
Extension template is way faster than Appinventor sources as it only compiles the extension files and Appinventor sources also compiles the components present in the components folder.

  1. https://github.com/mit-cml/appinventor-extensions ( Extension Template )
  2. https://github.com/mit-cml/appinventor-sources ( Appinventor Sources )
  3. Rush • A new and improved way of building extensions ( Rush )

And for the Editor I will suggest to install VSCode as its suited for begginers and has mostly all functions that you can think of and also its not Resource Heavy. After that you can think of IntelliJ Idea

For now you can't import gradle dependencies. However you can search the pachage name in Google or in search.maven.org for its specific JARs or AARs
Note: AARs are not fully supported by Appinventor fully.

In an extension you can't add your own XML for specific Layouts or widgets. You need to use their Java class to create a new instance of them and add it to specific View components
For example:
Button btn = new Button(this.context);

For the width I believe you can use setHeight(); and setWidth(); for Height and Width respectively.

3 Likes

A small correction.

VS Code is a source code editor while Intellij IDEA is an IDE. You should not compare both like this.

4 Likes

Thanks. Also can I make a project, export it apk and import it in Android Studio for further work..?

Sure. Thanks!

No can't export a extension to a Android Studio project and neither a AI2 Project.

Just one more request...

I want to build admob extension. Will you go over to Documentations and see if I can build extension for it or not.

1 Like

Nothing is impossible, but, Just start from basics :wink: I am myself learning extension development from November 2020 and on May 2021, I found myself efficient to make extensions,

Keep Learning, Keep Inventing !

2 Likes

Ya...I just need some directions like its asking for pasting xml code...which is not possible

2 Likes

No need for xml code, you can do same with @UsesApplicationMetadata and @UsesActivities Annotations, if you need any help, just ask, the community will give out its best to help you

2 Likes

Also, starting from admob is not good at all, try doing some basic extensions in beginning

3 Likes

I tried to create basic Maths operations extensions but build is failing. I am getting this problem :point_down:

Capture

Have you cloned deps? Make sure to have a look at readme file.

1 Like

I did that. I cloned it in extension-template-master folder and it created an new folder named my-extension.

But still, the problem exists.

(I am launching ant extensions command in extension-template-master folder. Am I supposed to launch it somewhere else?

I am unable to build xtensions and getting the following error :point_down:

Capture

Try to learn from this tutorial, read carefully and practice.
https://saitwalshreyash19.medium.com/writing-extensions-for-app-inventor-2-and-kodular-7d20092bff16
I'm sure you can solve your problem by yourself. Good Luck :wink:

"The more you read, the more things you will know. The more you learn, the more places you’ll go"

What you have done so far?

1 Like

I think the problem is due to cloning.
I cloned it in extension-template-master folder and it created an new folder named my-extension .

But still, the problem exists.

(I am launching ant extensions command in extension-template-master folder. Am I supposed to launch it somewhere else?

Put your directory tree here.

You have to run it in the directory where the build.xml exists...

1 Like