gpt4 book ai didi

android - phonegap 简单示例在 android 模拟器中不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 10:48:13 24 4
gpt4 key购买 nike

我遵循了基本 Phonegap 教程(Eclipse、Android SDK、ADT Phonegap)中的所有步骤,我创建了一个 index.html 页面(代码来自 phonegap 站点)和 cordova-2.2 assets/www 文件夹中的 .0.jscordova-2.2.0.jar,当我运行它时,它在控制台屏幕上显示了这条消息:

[2013-09-05 12:44:14 - phonegape-test] ------------------------------
[2013-09-05 12:44:14 - phonegape-test] Android Launch!
[2013-09-05 12:44:14 - phonegape-test] adb is running normally.
[2013-09-05 12:44:14 - phonegape-test] No Launcher activity found!
[2013-09-05 12:44:14 - phonegape-test] The launch will only sync the application package on the device!
[2013-09-05 12:44:14 - phonegape-test] Performing sync
[2013-09-05 12:44:14 - phonegape-test] Automatic Target Mode: launching new emulator with compatible AVD 'STest'
[2013-09-05 12:44:14 - phonegape-test] Launching a new emulator with Virtual Device 'STest'
[2013-09-05 12:44:27 - phonegape-test] New emulator found: emulator-5554
[2013-09-05 12:44:27 - phonegape-test] Waiting for HOME ('android.process.acore') to be launched...
[2013-09-05 12:46:25 - phonegape-test] HOME is up on device 'emulator-5554'
[2013-09-05 12:46:25 - phonegape-test] Uploading phonegape-test.apk onto device 'emulator-5554'
[2013-09-05 12:46:26 - phonegape-test] Installing phonegape-test.apk...
[2013-09-05 12:47:35 - phonegape-test] Success!
[2013-09-05 12:47:35 - phonegape-test] \phonegape-test\bin\phonegape-test.apk installed on device
[2013-09-05 12:47:35 - phonegape-test] Done!

但该应用程序无法运行,而且我没有找到我的应用程序 lancher 图标!你能帮帮我吗!

编辑:MainActivity.java :

package com.example.phonegape;

import android.os.Bundle;
import android.view.Menu;
import org.apache.cordova.*;
//import com.phonegap.DroidGap;

public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
super.loadUrl("file:///assets/www/index.html");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

最佳答案

我知道您的 index.html 位于 assets 文件夹中,但请尝试将 super.loadUrl 行更改为:

super.loadUrl("file:///android_asset/www/index.html");

根据本教程 PhoneGap Documentation - Getting Started with Android

关于android - phonegap 简单示例在 android 模拟器中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18635572/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com