我尝试按照本教程进行操作:
http://docs.phonegap.com/en/2.7.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

并得到以下错误:

05-08 15:35:59.845: E/dalvikvm(307): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.getWhitelistResponse

在这里,一个人解释了错误:https://issues.apache.org/jira/browse/CB-3041
This is a known issue. Because Android 2.3 does not have android.webkit.WebResourceResponse, this code is considered dead by Android 2.3's Dalvik. This means your whitelisting doesn't work properly like it does on Android 4.x, as per CB-2099. I'm going to keep this open, but lower the priority, since we know what causes it and it's an easy "First Bug" for someone if they really want to fix this.

他说修复很容易,但是没有说明如何修复-.-
杰出的!

显然,一种解决方法是不要与Android 2.2模拟器一起运行,因为它可以与Android 4.2一起使用。

但是,如何在Android 2.2中使用它呢?

我想构建一个与API Level 8及更高版本兼容的应用程序。

最佳答案

这是因为Android 2.2没有带有WebResource Response的更新的Webkit。

尝试从here下载cordova 2.2 jar并将其放在项目基础的/libs文件夹中。如果不存在,请创建一个。您可能还必须将IceCreamCordovaWebViewClient.java添加到源中(或者,如果您选择下载cordova的源代码并将其作为依赖项添加,则可以将其添加到该源中)

或者,您可以尝试使用常规的WebViewClient/ChromeClient自行完成工作,如MHthis post中概述的一样,复制如下。



编辑:

另外,您也可以尝试将WebResourceResponse和依赖项添加到src文件夹中。尝试从here下载它们

关于android - 在Android 2.2上运行HelloCordova时找不到类 'android.webkit.WebResourceResponse',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16444996/

10-11 19:57