2013-02-28 36 views
2

我有一个Android应用程序,使用网页视图加载一个网页,有一个谷歌地图和一些JavaScript的Android应用程序可以交互,以绘制引脚和做操作信息框点击等在导出为签名后的网页浏览器不加载页面

我通过https托管我的网页在现场制作服务器上。

所以,我有我的Web视图加载页面,像这样:

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中运行应用程序,与和W/O degub,它的工作原理。 Web视图加载地图。交互工作。尼斯。

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

回答

2

注释掉ProGuard的修正!

1

嗨,我有同样的问题,但现在我解决了你需要生成一个新的密钥,你从你签署的APK的新的密钥库调试目的,你必须使用你的android debug.keystore,但你有你自己的生产的.keystore文件,去到Android文档,以“如何生成的地图API密钥。

请参阅这篇文章,详细信息Click here

+0

这是真的,即使当我使用基于谷歌地图的网页的Web视图加载内?请注意,我没有使用android地图视图控件。谢谢。 – topwik 2013-02-28 17:50:24

+0

我只是尝试将网址更改为google.com之类的东西,而不是我的主要公司webstie,而是构建APK并将其安装在我的设备上,并正确加载页面。所以可能有一些API的关键是我缺少的东西... – topwik 2013-02-28 18:06:59

+0

是在你主公司网站的网址由API密钥组成,所以它只用于调试目的,然后你签署了apk,所以它是无效的,你应该生成新的密钥使用你的签名密钥库然后尝试它会工作... – androidgeek 2013-02-28 18:13:34

相关问题