1

我在 Eclipse 中使用 android。使用 phonegap 从资产文件夹运行 HTML5 组件。使用 android 4.0.3 api 的模拟器中没有 Html 组件。

无法加载顶点着色器错误消息正在 logcat 中。

下面给出了我的 Activity 类。在该类中,我使用了 droidGap 类的 loadUrl 方法。

我试图加载一个 HTML5 页面,它实际上是一个登录页面,蓝屏仅在尝试运行项目时出现。

package com.plugin.myapp;
import java.io.IOException;
import java.io.InputStream;
import org.apache.cordova.DroidGap;
import android.content.res.AssetManager;
import android.os.Bundle;

public class MainActivity extends DroidGap {
    private static MainActivity instance;

    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);   
        super.init();  

        super.loadUrl("file:///android_asset/www/tdc_tutorial.html");
        //super.loadUrl("file:///android_asset/www/web/index.html",10000); 
    }
}

manifest.xml 在下面给出

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.plugin.myapp"
        android:versionCode="1"
        android:versionName="1.0" >
    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />
    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="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.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.WRITE_INTERNAL_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" />

    <uses-permission android:name="android.permission.INTERNET" />
    <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" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>    
</manifest>

LogCat 错误消息

10-25 10:30:06.649: D/dalvikvm(610): WAIT_FOR_CONCURRENT_GC blocked 5ms
10-25 10:30:06.669: I/CordovaLog(610): Changing log level to DEBUG(3)
10-25 10:30:06.669: I/CordovaLog(610): Found preference for useBrowserHistory
10-25 10:30:06.669: D/DroidGap(610): DroidGap.onCreate()
10-25 10:30:06.759: D/DroidGap(610): DroidGap.init()
10-25 10:30:06.839: D/DroidGap(610): DroidGap.loadUrl(file:///android_asset/www/tdc_tutorial.html)
10-25 10:30:06.839: D/DroidGap(610): DroidGap: url=file:///android_asset/www/tdc_tutorial.html baseUrl=file:///android_asset/www/
10-25 10:30:06.839: D/PluginManager(610): init()
10-25 10:30:06.939: D/SoftKeyboardDetect(610): Ignore this event
10-25 10:30:06.999: D/gralloc_goldfish(610): Emulator without GPU emulation detected.
10-25 10:30:07.209: D/SoftKeyboardDetect(610): Ignore this event
10-25 10:30:08.029: D/CordovaLog(610): Viewport argument value "device-width;initial-scale" for key "width" not recognized. Content ignored.
10-25 10:30:08.029: D/CordovaLog(610): file:///android_asset/www/tdc_tutorial.html: Line 8 : Viewport argument value "device-width;initial-scale" for key "width" not recognized. Content ignored.
10-25 10:30:08.029: E/Web Console(610): Viewport argument value "device-width;initial-scale" for key "width" not recognized. Content ignored. at file:///android_asset/www/tdc_tutorial.html:8
10-25 10:30:08.029: D/CordovaLog(610): Viewport argument key "1.0;" not recognized and ignored.
10-25 10:30:08.039: D/CordovaLog(610): file:///android_asset/www/tdc_tutorial.html: Line 8 : Viewport argument key "1.0;" not recognized and ignored.
10-25 10:30:08.039: E/Web Console(610): Viewport argument key "1.0;" not recognized and ignored. at file:///android_asset/www/tdc_tutorial.html:8
10-25 10:30:08.279: D/chromium(610): Unknown chromium error: -6
10-25 10:30:11.059: E/SQLiteLog(610): (14) cannot open file at line 30174 of [00bb9c9ce4]
10-25 10:30:11.059: E/SQLiteLog(610): (14) os_unix.c:30174: (2) open(/CachedGeoposition.db) - 
10-25 10:30:11.059: D/WebKit(610): ERROR: 
10-25 10:30:11.059: D/WebKit(610): SQLite database failed to load from /CachedGeoposition.db
10-25 10:30:11.059: D/WebKit(610): Cause - unable to open database file
10-25 10:30:11.059: D/WebKit(610): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
10-25 10:30:15.740: D/CordovaLog(610): Uncaught TypeError: Cannot read property 'Object' of undefined
10-25 10:30:15.740: D/CordovaLog(610): file:///android_asset/www/TestClient.lzx.js?: Line 1 : Uncaught TypeError: Cannot read property 'Object' of undefined
10-25 10:30:15.749: E/Web Console(610): Uncaught TypeError: Cannot read property 'Object' of undefined at file:///android_asset/www/TestClient.lzx.js?:1
10-25 10:30:26.050: D/dalvikvm(610): GC_CONCURRENT freed 305K, 5% free 8423K/8839K, paused 82ms+5ms, total 117ms
10-25 10:37:41.439: D/dalvikvm(610): GC_CONCURRENT freed 426K, 6% free 8431K/8967K, paused 75ms+4ms, total 119ms
10-25 10:44:16.459: D/dalvikvm(610): GC_CONCURRENT freed 398K, 6% free 8456K/8967K, paused 76ms+5ms, total 120ms

任何机构都可以帮我解决这个问题。

4

1 回答 1

0

根据您的日志中的这些行:

10-25 10:30:11.059: D/WebKit(610): ERROR: 
10-25 10:30:11.059: D/WebKit(610): SQLite database failed to load from /CachedGeoposition.db
10-25 10:30:11.059: D/WebKit(610): Cause - unable to open database file
10-25 10:30:11.059: D/WebKit(610): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
10-25 10:30:15.740: D/CordovaLog(610): Uncaught TypeError: Cannot read property 'Object' of undefined
10-25 10:30:15.740: D/CordovaLog(610): file:///android_asset/www/TestClient.lzx.js?: Line 1 : Uncaught TypeError: Cannot read property 'Object' of undefined
10-25 10:30:15.749: E/Web Console(610): Uncaught TypeError: Cannot read property 'Object' of undefined at file:///android_asset/www/TestClient.lzx.js?:1

您的代码正在尝试读取一些无法执行的 sql 文件。你可能想看看这个

于 2012-10-25T05:34:46.260 回答