Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 导出到已签名的APK后web视图未加载页面_Android_Google Maps_Google Maps Api 3 - Fatal编程技术网

Android 导出到已签名的APK后web视图未加载页面

Android 导出到已签名的APK后web视图未加载页面,android,google-maps,google-maps-api-3,Android,Google Maps,Google Maps Api 3,我有一个android应用程序,它使用一个web视图加载一个网页,该网页有一个谷歌地图和一些javascript,android应用程序可以与之交互,以绘制PIN并在信息框点击时执行操作等 我正在通过https在实时生产服务器上托管我的页面 因此,我让我的web视图按如下方式加载页面: String mapViewUrl = "https://mywebsite.com/mywebsite/MyMapApp/Default.html"; in OnCreate: webMapVie

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

我正在通过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运行应用程序时,使用和不使用degub,它就可以工作了。Web视图加载地图。互动是有效的。很好

然后我导出一个签名的APK。将APK复制到我的设备。安装它。运行它。没有地图。只有一个空白的白色网络视图和我的android控件。有什么好处?
有人能提供建议吗?

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


请参阅本文,了解更多详细信息。

通过评论ProGuard!修复。

即使在我使用基于谷歌地图的网页的Web视图时,这是真的吗?请注意,我没有使用android地图视图控件。谢谢。我只是尝试将url更改为类似google.com的内容,呃,我的main公司网站相反,构建APK并将其安装在我的设备上,它可以正确加载页面。因此,我可能缺少一些API密钥…是的,在您的主要公司网站url中包含API密钥,因此它仅用于调试目的,然后您对APK进行了签名,因此它无效。您应该使用已签名的密钥库生成新密钥,然后重试将工作…我不确定我是否完全了解你。因此,如果我加载一个常规网站,如我的webview中的google.com,构建我的APK并将其安装在我的手机上,网页将正常显示。如果我加载它在eclipse中工作,没有密钥(我想…)但是一旦我建立了APK,空白页面。我在哪里可以得到这个键?它和android地图查看键一样吗?哦!!!!