MIT app inventor offline server [ Win10 LTSC 64 ]

  1. download file and install
    Chrome

    https://www.google.com/chrome/browser/desktop/index.html?system=true&standalone=1

    Google-cloud-sdk

    https://cloud.google.com/sdk/docs/quickstart-windows
    https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe

    Openjdk 1.8

    https://developers.redhat.com/products/openjdk/download
    https://developers.redhat.com/download-manager/file/java-1.8.0-openjdk-1.8.0.242-3.b08.redhat.windows.x86_64.msi

    Git

    https://git-scm.com/download/win
    https://github.com/git-for-windows/git/releases/download/v2.26.0.windows.1/Git-2.26.0-64-bit.exe

    Ant

    https://ant.apache.org/bindownload.cgi
    https://downloads.apache.org//ant/binaries/apache-ant-1.10.7-bin.zip
    apache_ant1


    add Ant bin path to PATH environment variable

2.check

ant -version
git --version
java -version
gcloud components list
gcloud components install app-engine-java
gcloud components update

3.admin cmd

cd c:\
mkdir ai2
cd ai2
chcp 65001
set JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
git clone https://github.com/mit-cml/appinventor-sources.git
cd appinventor-sources
copy sample-.gitignore .gitignore
git submodule update --init
cd appinventor
call ant MakeAuthKey
call ant

4.test

java_dev_appserver.cmd --port=8888 --address=0.0.0.0 --disable_update_check appengine/build/war/

Ctrl +C Terminate batch job

5.move file

move /y “appinventor-sources\appinventor\buildserver\build\run\lib” BuildServer
move /y “appinventor-sources\appinventor\appengine\build\war” DevServer

6.Ai2Rundev.bat

@echo off
%1(start /min cmd.exe /c %0 :&exit)
chcp 65001
echo “Starting App Inventor 2 DevAppServer…”
title DevAppServer
cd %~dp0

SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"

for /f “tokens=1-5” %%i in (‘netstat -ano^|findstr “8888”’) do (
echo kill the process %%m use the port 8888
taskkill /F /T /pid %%m
)

java_dev_appserver.cmd --port=8888 --disable_update_check --address=0.0.0.0 DevServer

7.Ai2Runbud.bat

@echo off
%1(start /min cmd.exe /c %0 :&exit)
chcp 65001
echo “Starting App Inventor 2 BuildServer…”
title BuildServer
cd %~dp0

SET _JAVA_OPTIONS= -Xms64m -Xmx1024m
SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
for /f “tokens=1-5” %%i in (‘netstat -ano^|findstr “:9990”’) do (
echo kill the process %%m use the port 9990
taskkill /F /T /pid %%m
)

cd BuildServer

java -cp “*” com.google.appinventor.buildserver.BuildServer

8.update.bat

@echo off

chcp 65001
SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
cd %~dp0

cd appinventor-sources
title git code
git reset --hard
git pull
git submodule update --init

cd appinventor
title ant
call ant clean
call ant
cd …/…

rem pause

for /f “tokens=1-5” %%i in (‘netstat -ano^|findstr “:9990”’) do (
echo kill the process %%m use the port 9990
taskkill /F /T /pid %%m
)

for /f “tokens=1-5” %%i in (‘netstat -ano^|findstr “8888”’) do (
echo kill the process %%m use the port 8888
taskkill /F /T /pid %%m
)

xcopy /e /s /y “DevServer\WEB-INF\appengine-generated” .\appengine-generated\

move /y “appinventor-sources\appinventor\buildserver\build\run\lib” BuildServer
move /y “appinventor-sources\appinventor\appengine\build\war” DevServer

xcopy /e /s /y .\appengine-generated “DevServer\WEB-INF\appengine-generated”

start Ai2Runbud.bat
start Ai2Rundev.bat

1 Like

ai2

Run Ai2Runbud.bat and Ai2Rundev.bat
Chrome 打开 http://127.0.0.1:8888

Modify java code before "call ant "

appinventor-sources\appinventor\appengine\src\com\google\appinventor\server\storage\ObjectifyStorageIo.java
line 50
==>
private static final Flag maxAssetSizeMegs = Flag.createFlag(“max.asset.size.megs”, 9f);
<==
private static final Flag maxAssetSizeMegs = Flag.createFlag(“max.asset.size.megs”, 99f);

and

appinventor-sources\appinventor\appengine\src\com\google\appinventor\server\FileImporterImpl.java
line 1336
==>
return 5 * 1024 * 1024;
<==
return 99 * 1024 * 1024;

you can create larger aia (> 9 MB and < 99 MB) , build apk < 5Mb.

ant RunMain -Dzip.file=test.aia -Duser.name=test@gmail.com -Doutput.dir=.

can build a big apk.

or run cmd in BuildServer directory build apk.

java -cp “*” com.google.appinventor.buildserver.Main --inputZipFile test.aia --userName test@gmail.com