gpt4 book ai didi

android - 更新 ADT 后,测试应用程序(phonegap)无法运行

转载 作者:太空狗 更新时间:2023-10-29 16:41:39 27 4
gpt4 key购买 nike

我正在学习 phonegap,在更新 ADT 之前,应用程序运行良好,这是 index.html

<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<script type="text/javascript" src="cordova-2.7.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<link rel="stylesheet" href="jquery.mobile-1.3.1.min.css" />
<script src="jquery-1.8.3.min.js"></script>
<script src="jquery.mobile-1.3.1.min.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</head>
<body>
<div data-role="page" id="page_dashboard">

<script type="text/javascript" charset="utf-8" src="scripts/dashboard.js"></script>

<div data-role="header">
<h1>Dashboard</h1>
</div><!-- /header -->

<div data-role="content">
<p><a href="#page_login" data-role="button" id="button_login">Login</a></p>
<p><a href="#" data-role="button" id="button_logout">Logout</a></p>
</div><!-- /content -->

</div>
</body>
</html>

这是.java

package com.hkinterview;

import android.os.Bundle;
import org.apache.cordova.*;

public class hkinterview extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}

错误:

    05-30 07:27:49.223: E/AndroidRuntime(934): FATAL EXCEPTION: main
05-30 07:27:49.223: E/AndroidRuntime(934): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hkinterview/com.hkinterview.hkinterview}: java.lang.ClassNotFoundException: Didn't find class "com.hkinterview.hkinterview" on path: /data/app/com.hkinterview-2.apk
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.os.Looper.loop(Looper.java:137)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-30 07:27:49.223: E/AndroidRuntime(934): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 07:27:49.223: E/AndroidRuntime(934): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 07:27:49.223: E/AndroidRuntime(934): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-30 07:27:49.223: E/AndroidRuntime(934): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-30 07:27:49.223: E/AndroidRuntime(934): at dalvik.system.NativeStart.main(Native Method)
05-30 07:27:49.223: E/AndroidRuntime(934): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.hkinterview.hkinterview" on path: /data/app/com.hkinterview-2.apk
05-30 07:27:49.223: E/AndroidRuntime(934): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-30 07:27:49.223: E/AndroidRuntime(934): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-30 07:27:49.223: E/AndroidRuntime(934): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-30 07:27:49.223: E/AndroidRuntime(934): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-30 07:27:49.223: E/AndroidRuntime(934): ... 11 more
05-30 07:31:17.932: E/Trace(992): error opening trace file: No such file or directory (2)
05-30 07:31:18.074: W/dalvikvm(992): Unable to resolve superclass of Lcom/hkinterview/hkinterview; (15)
05-30 07:31:18.123: W/dalvikvm(992): Link of class 'Lcom/hkinterview/hkinterview;' failed
05-30 07:31:18.123: D/AndroidRuntime(992): Shutting down VM
05-30 07:31:18.132: W/dalvikvm(992): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
05-30 07:31:18.154: E/AndroidRuntime(992): FATAL EXCEPTION: main
05-30 07:31:18.154: E/AndroidRuntime(992): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hkinterview/com.hkinterview.hkinterview}: java.lang.ClassNotFoundException: Didn't find class "com.hkinterview.hkinterview" on path: /data/app/com.hkinterview-1.apk
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.os.Looper.loop(Looper.java:137)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-30 07:31:18.154: E/AndroidRuntime(992): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 07:31:18.154: E/AndroidRuntime(992): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 07:31:18.154: E/AndroidRuntime(992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-30 07:31:18.154: E/AndroidRuntime(992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-30 07:31:18.154: E/AndroidRuntime(992): at dalvik.system.NativeStart.main(Native Method)
05-30 07:31:18.154: E/AndroidRuntime(992): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.hkinterview.hkinterview" on path: /data/app/com.hkinterview-1.apk
05-30 07:31:18.154: E/AndroidRuntime(992): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-30 07:31:18.154: E/AndroidRuntime(992): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-30 07:31:18.154: E/AndroidRuntime(992): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-30 07:31:18.154: E/AndroidRuntime(992): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-30 07:31:18.154: E/AndroidRuntime(992): ... 11 more

-------------------- list ------------------------

<uses-permission android:name="android.permission.CAMERA" />
<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.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<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" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>

<application android:icon="@drawable/icon" android:label="@string/app_name"
android:hardwareAccelerated="true"
android:debuggable="true">
<activity android:name="hkinterview" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

最佳答案

@hkinterview

我有类似的问题,我按照 user1971705 提到的解决了它。

  1. 右键单击您的项目 -> 属性
  2. 单击左侧 Pane 中的 Java Build Path
  3. 单击右侧 Pane 中的“订购和导出”选项卡
  4. 确保选中“Android Private Libraries”
  5. 点击确定

关于android - 更新 ADT 后,测试应用程序(phonegap)无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16830470/

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