2

我有一个 android 应用程序,它使用 web 视图加载一个网页,该网页有一个谷歌地图和一些 javascript,android 应用程序可以与之交互以绘制图钉并在信息框点击等时执行操作。

我通过 https 在实时生产服务器上托管我的页面。

所以我让我的网络视图像这样加载页面:

String mapViewUrl = "https://mywebsite.com/mywebsite/MyMapApp/Default.html";

in OnCreate:


    webMapView = (WebView) findViewById(R.id.webMapView);

    webMapView.getSettings().setJavaScriptEnabled(true);
    webMapView.addJavascriptInterface(new JavaScriptInterface(this), "android");
    webMapView.getSettings().setPluginsEnabled(true);
    webMapView.getSettings().setDomStorageEnabled(true);
    webMapView.getSettings().setBuiltInZoomControls(true);
    webMapView.getSettings().setSupportZoom(true);
    webMapView.getSettings().setAllowFileAccess(true);
    webMapView.getSettings().setGeolocationEnabled(true);

        final String centerURL = "javascript:centerAt(" + lat + "," + lon + ")";

          //Wait for the page to load then send the location information
          webMapView.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageFinished(WebView view, String url){
                webMapView.loadUrl(centerURL);
            }
          });
          webMapView.loadUrl(mapViewUrl);

现在,当我通过 eclipse 运行应用程序时,使用和不使用 degu,它可以工作。Web 视图加载地图。互动作品。好的。

然后我导出一个签名的 APK。将 APK 复制到我的设备。安装它。运行。没有地图。我的 android 控件只是一个空白的白色 web 视图。是什么赋予了?任何人都可以提供任何建议吗?

4

2 回答 2

2

通过注释掉 ProGuard 来修复!

于 2013-02-28T22:11:06.457 回答
1

嗨,我遇到了同样的问题,但现在我解决了您需要使用新的密钥库生成一个新密钥,您从中签署 APK 以进行调试,您必须使用您的 android debug.keystore 但对于生产,您有自己的 .keystore 文件,转到 android 文档以“如何生成地图 api 密钥。

请参阅此帖子以获取更多详细信息单击此处

于 2013-02-28T17:46:12.627 回答