Add components in ai2 offline pls help me

https://sourceforge.net/projects/ai2offline/ link of ai2 offline

i have components of java & class file like MockChronometer.class..., and i want to add in ai2 offline

so how can i add & where to edit pls help me

you can not add a .class file into the source code.

first of all, if you want to add a new component please use the latest MIT App Inventor source code from GitHub.

for that you need

  1. Java Version - 1.8.x
    for checking the version java -version
  2. Apache Ant
    for checking the version ant -version
  3. Git version controller so that you can update your source code with the latest MIT App Inventor source code.
    for checking the version git --version
  4. Cloud SDK

for installations
follow these commands

  1. git clone https://github.com/YOUR_USER_NAME/appinventor-sources.git
  2. cd appinventor-sources
  3. git remote add upstream https://github.com/mit-cml/appinventor-sources.git
  4. git submodule update --init
  5. cd appinventor
  6. ant MakeAuthKey
  7. ant

these commands build your local copy of its app inventor please wait because the building process depends on your system.

  1. cd appinventor/buildserver
  2. ant RunLocalBuildServer

now open a new instance of your CMD or git terminal and run the following command

  1. your-google-cloud-SDK-folder/bin/java_dev_appserver.sh --port=8888 --address=0.0.0.0 appengine/build/war/

You should now be up and running; you can test this by pointing your browser to: http://localhost:8888

Note

  1. please don't use space into folder name this will break the building process.
2 Likes

For more information you can search https://mit-cml.github.io/appinventor-sources/

also fell free to ask question.

1 Like

this error is coming im trying from 3 weeks pls help me

Capture2 Capture1

This are my setting i have seen in manual

Hello Shivaprasad, You are missing the Appinventor blockly submodules, you should run:
git submodule update --init
See also the installation guide here:


P.S: why are your folder name is kodular. This might suggest that you are copying it.

im not coping kodular i save my aia in kodular folder ,

in that kodular folder i saved appinventor-sources

1 Like

i have tried buy this error comes, can u help on anydisk pls

Looks like you have downloaded the Appinventor repository instead of cloning it, and therefore, you will not be able to download the submodules.
You should try again by following this guide:

git init
git remote add upstream https://github.com/mit-cml/appinventor-sources.git

then try
git submodule update --init

Ok done I have changed _JAVA_OPTIONS -Xmx1052M to. -Xmx2048M

Now tell me how to add new comment on app inventor offline

If you want to add components then please navigate to
appinventor-sources\appinventor\components\src\com\google\appinventor\components\runtime

and paste your java file there.
Then recompile & redeploy.

Component not added

I have added package com.google.appinventor.components.runtime;

1st I add java file in components/run

2nd And cd appinventor-sources\appinventor\ ant

Build successful .....

3rd I have restarted sever again....

I can't see that component what I have added

@SimpleObject annotation must be external = false

can you please share your code ?

// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the MIT License https://raw.github.com/mit-cml/app-inventor/master/mitlicense.txt

package com.google.appinventor.components.runtime;

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.common.YaVersion;
import com.google.appinventor.components.runtime.util.AnimationUtil;
import com.google.appinventor.components.runtime.util.MediaUtil;
import com.google.appinventor.components.runtime.util.ViewUtil;
import com.google.appinventor.components.annotations.UsesLibraries;

import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
//import com.google.ads.*;
//HUPDATE
import com.google.android.gms.ads.*;

import java.io.IOException;
import android.widget.LinearLayout;

/**
 * Component for displaying images and animations.
 *
 */
@DesignerComponent(version = YaVersion.IMAGE_COMPONENT_VERSION,
    category = ComponentCategory.BASIC,
    description = "Component for displaying images.  The picture to display, " +
    "and other aspects of the Image's appearance, can be specified in the " +
    "Designer or in the Blocks Editor.")
@SimpleObject
@UsesPermissions(permissionNames = "android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE")
@UsesLibraries(libraries = "admob.jar")
public final class AdMob extends AndroidViewComponent {
  
  private final LinearLayout superview;
  private AdView view;
  
  
  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "")
  @SimpleProperty()
  public void ID(String ID) { 
  //HUPDATE
  //     view = new AdView(container.$context(), AdSize.BANNER, ID);
		view = new AdView(container.$context());
		//view.setAdSize(AdSize.BANNER);
		view.setAdUnitId(ID);
  
       //superview.addView(view);
       //view.loadAd(new AdRequest());
  }
  
 @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "")
  @SimpleProperty()
  public void Size(String SIZE) { 
		view.setAdSize(AdSize.BANNER);
		//DISPLAY NAW
       superview.addView(view);
       //view.loadAd(new AdRequest());
       AdRequest adRequest = new AdRequest.Builder().build();

   // Start loading the ad in the background.
       view.loadAd(adRequest);
  }  
  
 /**
   * Creates a new AdMob component.
   *
   * @param container  container, component will be placed in
   */
  public AdMob(ComponentContainer container) {
    super(container);
    //view = new AdView(container.$context(), AdSize.BANNER, "a195766848864512");
	superview = new LinearLayout(container.$context());
    // Adds the component to its designated container
    container.$add(this);
	//view.loadAd(new AdRequest());
  }

  
  @Override
  public View getView() {
    return superview;
  }
  
}

formatted by Taifun and the preformatted text option

BASIC component category I think not present in app inventor.
Have you added into system?

2nd thing I want to tell you this is visible component so that you need to mention into @DesignerComponent annotations.

If this is visible component then you need to create mock component for that into appengine folder

Please follow this guidelines for adding new component into MIT app inventor

https://mit-cml.github.io/appinventor-sources/

Read this guidelines carefully if you find any problem then please feel free to ask.