我正在尝试在我的应用上嵌入CordovaWebview。单独站立已经有效但是当试图嵌入它时,webview加载index.html一秒钟,然后app退出!
XML,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<org.apache.cordova.CordovaWebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id = "@+id/cordovaWebview"/>
</LinearLayout>
java class,
public class AndroidPGBase extends Activity implements CordovaInterface
{
CordovaWebView cordovaWebview;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
cordovaWebview = (CordovaWebView) findViewById(R.id.cordovaWebview);
cordovaWebview.loadUrl("file:///android_asset/www/index.html");
}
//这里实现了所有必需的方法,并在getActivity上返回“this”。
logcat的,
12-30 12:58:03.235: I/BootReceiver(1763): Copying /data/tombstones/tombstone_09 to DropBox (SYSTEM_TOMBSTONE)
12-30 12:58:03.265: I/WindowManager(1763): WIN DEATH: Window{409b5b80 com.myurl.androidpgbase/com.myurl.androidpgbase.AndroidPGBase paused=false}
12-30 12:58:03.265: I/ActivityManager(1763): Process com.myurl.androidpgbase (pid 28441) has died.
12-30 12:58:03.285: D/Zygote(1480): Process 28441 terminated by signal (11)
12-30 12:58:03.346: I/SemcMusicPlayer(15196): Client binding to ProxyService with intent action: com.sonyericsson.music.SERVICE. Returning binder.
12-30 12:58:03.346: E/CMarlinMediator(1481): [1079724664] ERROR : const sony::drm::CTime sony::drm::CMarlinMediator::getTrustedTime() calling tt_GetTrustedTime. return code 588120065
12-30 12:58:03.376: W/InputManagerService(1763): Got RemoteException sending setActive(false) notification to pid 28441 uid 10179
12-30 12:58:03.406: I/Mali-EGL(1927): Mali libraries compiled on Mar 6 2012, at 14:14:25
12-30 12:58:03.406: W/ActivityManager(1763): Unable to start service Intent { act=com.sonyericsson.airtouch.service.ACTION_ENABLE (has extras) }: not found
12-30 12:58:03.416: W/kernel(1487): [33873.732696] Mali<2>: MMU session begin
12-30 12:58:03.416: W/kernel(1487): [33873.732757] Mali<2>: Page directory for session 0xcf931700 placed at physical address 0x08FC9000
12-30 12:58:03.416: W/kernel(1487): [33873.732818] Mali<2>: MMU session begin: success
12-30 12:58:03.416: W/kernel(1487): [33873.732818] Mali<2>: Core: session_begin: for Mali-400 PP
12-30 12:58:03.416: W/kernel(1487): [33873.732849] Mali<2>: Core: session_begin: for Mali-400 GP
12-30 12:58:03.606: D/CustomizationProvider(1903): openFile -- START uri=content://com.sonyericsson.provider.customization/settings/com.sonyericsson.textinput.uxp
12-30 12:58:03.616: I/CrashMonitor(25656): CrashMonitorService: invokeService: android.intent.action.DROPBOX_ENTRY_ADDED
12-30 12:58:03.676: D/dalvikvm(15196): GC_EXPLICIT freed 245K, 47% free 3116K/5831K, external 1759K/2129K, paused 99ms
12-30 12:58:03.776: E/CMarlinMediator(1481): [1079454424] ERROR : const sony::drm::CTime sony::drm::CMarlinMediator::getTrustedTime() calling tt_GetTrustedTime. return code 588120065
12-30 12:58:03.786: E/CMarlinMediator(1481): [61] ERROR : const sony::drm::CTime sony::drm::CMarlinMediator::getTrustedTime() calling tt_GetTrustedTime. return code 588120065
12-30 12:58:03.796: I/SemcMusicPlayer(15196): Received a CallState event. State: 0
: E/(): Device disconnected