在Android上捆绑静态HTML网站的Premade APK模板?

时间:2011-08-24 03:47:31

标签: android webview apk

我有一个3MB的静态HTML / CSS / JS网站,我想把它打包成一个Android应用程序供离线使用。

是否有针对静态webapps的预制APK档案...我可以插入静态html / css / js并且应用程序被编程为加载“index.html”或其他东西? Presumablty我需要将index.html放在/ res / raw或/ assets中。我不是Java程序员,所以这就是我要问的主要原因。

据我所知,APK文件需要加密签名,但我可能稍后会这样做。

2 个答案:

答案 0 :(得分:1)

AppMobi使用您的网络应用程序,使用预先构建的模板进行编译,并为您提供最终的APK。确保使用自定义加载启动图像并在论坛中实施黑客解决方法以加速首次加载。

除了创建新项目并将web-app粘贴到项目文件夹中之外,您无需执行任何操作,然后按照屏幕截图进行操作。 And that hack I mentioned.

如果您有或了解gradle,我这样做是为了防止污染实际的网络应用程序:

task appmobi(dependsOn: [buildForWeb]) << {
    File indexFile = new File('build/index.html')

    def appMobiLoader = '''<script type="text/javascript" src="http://localhost:58888/_appMobi/appmobi.js"></script>
<script type="text/javascript">
function deviceReadyListener() {
    AppMobi.device.hideSplashScreen();
}
window.document.addEventListener("appMobi.device.ready", deviceReadyListener, false);
</script>'''

    def indexText = indexFile.text.replace("</head>", "$appMobiLoader</head>")
    indexFile.withWriter { writer ->
        writer.write(indexText)
    }
}

答案 1 :(得分:0)

查看PhoneGap项目。 http://www.phonegap.com/