我已经下载了Phonegap/Cordova的全新副本,以了解为什么我的应用程序不断抛出一些错误。Phonegap Cordova 2.0.0全新安装Hello World错误
我从Phonegap的“入门”开始,最后在Hello World上使用我的设备(HTC DesireHD和Android 2.3.3)。
因此,这个应用程序没有这样做,只是在设备上打印hello world。
应用程序工作然而这是伟大的,我得到我的日志一些不愉快的错误信息:
具体做法是:
09-06 17:26:31.487:E/dalvikvm(32594):可能未找到类 'android.webkit.WebResourceResponse',从方法 引用org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse 09-06 17:26:31.487:W/dalvikvm(32594):VFY:无法解析 new-实例452(Landroid/webkit/WebResourceResponse;)在 Lorg /阿帕奇/科尔多瓦/ CordovaWebViewClient;
然后我得到其他相关的错误重复。
我再说一遍,应用程序的工作,但我真的想不看到在日志中的任何错误:-)
已经提到,这可能是由于我的libs文件夹的名称,其他人(这是正确的名为库与"s"
)
我已经包括下面的副本我AndroidManifest.xml
,我MainActivity.java
和完整LogCat
。
我使用的是Win7,Eclipse 3.8。
非常感谢您的帮助。
的AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qwentes.phonegaptest" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="15" />
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/title_activity_main" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package com.qwentes.phonegaptest;
import android.os.Bundle;
import org.apache.cordova.*;
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
LogCat.txt
09-06 17:26:29.265: I/dalvikvm(32594): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
09-06 17:26:29.265: W/dalvikvm(32594): VFY: unable to resolve direct method 3117: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
09-06 17:26:29.265: D/dalvikvm(32594): VFY: replacing opcode 0x70 at 0x0001
09-06 17:26:29.265: D/dalvikvm(32594): VFY: dead code 0x0004-0059 in Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
09-06 17:26:29.705: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webview.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
09-06 17:26:29.705: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webview.db, mode: delete, disk free size: 554 M, handle: 0x34d960
09-06 17:26:30.606: V/webviewdatabase(32594): TCP pre connection: creating table in database
09-06 17:26:30.897: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webviewCache.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
09-06 17:26:30.897: D/Database(32594): dbopen(): path = /data/data/com.qwentes.phonegaptest/databases/webviewCache.db, mode: delete, disk free size: 554 M, handle: 0x372128
09-06 17:26:31.467: D/skia(32594): htcFlashPlugin::htcFlashPlugin
09-06 17:26:31.477: D/qct(32594): [WebView.WebView] >> Enable Shutdown = true
09-06 17:26:31.477: I/CordovaLog(32594): Changing log level to DEBUG(3)
09-06 17:26:31.477: I/CordovaLog(32594): Found preference for useBrowserHistory=false
09-06 17:26:31.477: D/CordovaLog(32594): Found preference for useBrowserHistory=false
09-06 17:26:31.487: E/dalvikvm(32594): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse
09-06 17:26:31.487: W/dalvikvm(32594): VFY: unable to resolve new-instance 452 (Landroid/webkit/WebResourceResponse;) in Lorg/apache/cordova/CordovaWebViewClient;
09-06 17:26:31.487: D/dalvikvm(32594): VFY: replacing opcode 0x22 at 0x0046
09-06 17:26:31.487: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.487: D/dalvikvm(32594): VFY: dead code 0x0048-004c in Lorg/apache/cordova/CordovaWebViewClient;.generateWebResourceResponse (Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
09-06 17:26:31.527: I/dalvikvm(32594): Could not find method android.webkit.WebViewClient.shouldInterceptRequest, referenced from method org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest
09-06 17:26:31.527: W/dalvikvm(32594): VFY: unable to resolve virtual method 3129: Landroid/webkit/WebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: D/dalvikvm(32594): VFY: replacing opcode 0x6f at 0x0015
09-06 17:26:31.527: D/dalvikvm(32594): VFY: dead code 0x0018-0019 in Lorg/apache/cordova/CordovaWebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
09-06 17:26:31.527: D/DroidGap(32594): DroidGap.init()
09-06 17:26:31.547: D/CordovaWebView(32594): >>> loadUrl(file:///android_asset/www/index.html)
09-06 17:26:31.547: D/PluginManager(32594): init()
09-06 17:26:31.547: D/CordovaWebView(32594): >>> loadUrlNow()
09-06 17:26:31.587: D/ATRecorder(32594): com.htc.autotest.dlib.RecordEngine in loader [email protected]
09-06 17:26:31.597: D/WindowManagerImpl(32594): addView, new view, mViews[0]: [email protected]
09-06 17:26:31.597: D/SoftKeyboardDetect(32594): Ignore this event
09-06 17:26:31.687: W/webcore(32594): Not supported in this case.
09-06 17:26:31.687: D/SoftKeyboardDetect(32594): Ignore this event
09-06 17:26:31.817: D/qct(32594): [RequestQueue.ActivePool.ActivePool] >> Enable Shutdown = true
09-06 17:26:31.817: D/qct(32594): [IdleCache.IdleCache] >> IDLE_CACHE_MAX = 40
09-06 17:26:32.418: D/DroidGap(32594): onMessage(onPageStarted,file:///android_asset/www/index.html)
09-06 17:26:32.558: D/szipinf(32594): Initializing inflate state
09-06 17:26:32.558: D/szipinf(32594): Initializing zlib to inflate
09-06 17:26:32.618: D/webkit-timers(32594): [JWebCoreJavaBridge::resume] >> do resume
09-06 17:26:32.738: D/dalvikvm(32594): GC_CONCURRENT freed 134K, 44% free 3208K/5639K, external 0K/0K, paused 2ms+20ms
09-06 17:26:33.729: D/Cordova(32594): onPageFinished(file:///android_asset/www/index.html)
09-06 17:26:33.729: D/CordovaWebView(32594): >>> loadUrlNow()
09-06 17:26:33.729: D/DroidGap(32594): onMessage(onNativeReady,null)
09-06 17:26:33.729: D/DroidGap(32594): onMessage(onPageFinished,file:///android_asset/www/index.html)
09-06 17:26:34.030: I/Database(32594): sqlite returned: error code = 14, msg = cannot open file at line 27206 of [42537b6056]
09-06 17:26:34.190: D/DroidGap(32594): onMessage(networkconnection,wifi)
09-06 17:26:34.230: D/DroidGap(32594): onMessage(spinner,stop)
09-06 17:26:35.741: D/DroidGap(32594): onMessage(spinner,stop)
09-06 17:26:44.430: D/dalvikvm(32594): GC_CONCURRENT freed 376K, 46% free 3284K/6023K, external 0K/0K, paused 2ms+3ms
09-06 17:27:34.619: D/dalvikvm(32594): GC_FOR_MALLOC freed 586K, 50% free 3133K/6151K, external 0K/0K, paused 43ms
09-06 17:28:04.808: D/dalvikvm(32594): GC_CONCURRENT freed 357K, 48% free 3208K/6151K, external 0K/0K, paused 6ms+3ms
我想答案就在这里: http://stackoverflow.com/a/11686466/1102741 最好的问候。 – Oscar
具体是哪个部分的答案? – Dave
“出现此问题是因为Android人员现在将”lib“文件夹重命名为”libs“。您需要创建一个libs文件夹而不是lib,然后将cordova.jar文件放在那里。只要我们将外部罐子放到这个“libs”文件夹中,它就会自动添加到应用程序的构建路径中。“ – Oscar