不清楚为啥App Inventor 2上传文件有5M大小的限制,编译的文件不能超过5M。只是从技术的角度想了解一下,就像墙在那里,就想翻一翻。。。
在ant之前,修改2处代码:
appinventor-sources-master\appinventor\appengine\src\com\google\appinventor\server\storage\ObjectifyStorageIo.java
@Override
public int getMaxJobSizeBytes() {
// TODO(user): what should this mean?
return 100 * 1024 * 1024; //上传限制改为100M
}
若上传大于10M的zip仍有文件太太的提示,修改appinventor-sources-master\appinventor\appengine\src\com\google\appinventor\server\FileImporterImpl.java文件。
// Maximum size of an uploaded asset, in megabytes.
private static final Flag<Float> maxAssetSizeMegs = Flag.createFlag("max.asset.size.megs", 100f);
appinventor-sources-master\appinventor\appengine\src\com\google\appinventor\server\project\youngandroid\YoungAndroidProjectService.java
if (zipFileLength >= (10 * 1024 * 1024) /* 5 MB */) { //编译最大10M文件。
String lengthMbs = format((zipFileLength * 1.0)/(1024*1024));
wrappedException = new IllegalArgumentException(
"Sorry, can't package projects larger than 10MB."
+ " Yours is " + lengthMbs + "MB.", e);
} else {
wrappedException = new IllegalArgumentException(
"Sorry, project was too large to package (" + zipFileLength + " bytes)");
}
}
这个数字改大了也没有用,超过10M会有出错提示:
不知道还能怎样改了。
假如你的文件超过10M,可以用本地命令行的方式编译:
ant RunMain -Dzip.file=d:\DuoRuiMi.aia -Duser.name=fsyzty@gmail.com -Doutput.dir=d:\temp
详见 appinventor-sources-master\appinventor\buildserver\README
当然也可用AI2U的 doapk.cmd DuoRuiMi https://www.youtube.com/watch?v=8_O_kcBk4GI How to build large Ai2 project with AI2U.
@echo off
cd /d %~dp0set ai2upath=%CD%
REM Copy your project to C:\AI2U\BuildProject\ eg. myapp.aia
REM Open cmd and type C:\AI2U\doapk.cmd myappcopy %ai2upath%\BuildProject\%1.aia %ai2upath%\BuildProject\%1.zip
set inputfile=%ai2upath%\BuildProject\%1.zipREM Change your.email@gmail.com to your email
set userName=your.email@gmail.comREM Final build store in BuildProject (Do not edit!!!)
set outputDir=%ai2upath%\BuildProjectREM Do not edit
set dxcache=%temp%\dxcache
cd BuildServer
"%ai2upath%\JDK\bin\java" -Xmx1500m -cp BuildServer.jar;CommonUtils.jar;CommonVersion.jar;FastInfoset-1.2.2.jar;activation-1.1.jar;args4j-2.0.18.jar;asm-3.1.jar;bcpkix-jdk15on-149.jar;bcprov-jdk15on-149.jar;commons-io-2.0.1.jar;grizzly-servlet-webserver-1.9.18-i.jar;guava-14.0.1.jar;http-20070405.jar;jackson-core-asl-1.9.4.jar;jaxb-api-2.1.jar;jaxb-impl-2.1.10.jar;jaxb-xjc.jar;jdom-1.0.jar;jersey-bundle-1.3.jar;jersey-multipart-1.3.jar;jettison-1.1.jar;json.jar;jsr311-api-1.1.1.jar;localizer;jar;mail-1.4.jar;rome-0.9.jar;sdklib.jar;stax-api-1.0-2.jar;wadl-cmdline.jar;wadl-core.jar;wadl2java.jar -Dfile.encoding=UTF-8 com.google.appinventor.buildserver.Main --inputZipFile %inputfile% --userName %username% --outputDir %outputdir% --dexCacheDir %dxcache%del %ai2upath%\BuildProject\%1.zip
cd %ai2upath%
感谢 krupong的分享: https://sourceforge.net/projects/ai2u/files/?source=navbar
学习 App Inventor 2,推荐关注微信号:"老巫婆的程序世界"