我使用的是最新版本的PhoneGap。我正在使用他们的代码,仅修改了应用程序名称,当我在模拟器上运行它时,我收到此错误:“不幸的是,phonegapExample已停止”。
我的LogCat:
12-07 00:04:48.573: I/Process(996): Sending signal. PID: 996 SIG: 9
12-07 00:04:51.814: W/Trace(1013): Unexpected value from nativeGetEnabledTags: 0
12-07 00:04:51.814: W/Trace(1013): Unexpected value from nativeGetEnabledTags: 0
12-07 00:04:51.814: W/Trace(1013): Unexpected value from nativeGetEnabledTags: 0
12-07 00:04:52.043: W/Trace(1013): Unexpected value from nativeGetEnabledTags: 0
12-07 00:04:52.053: W/Trace(1013): Unexpected value from nativeGetEnabledTags: 0
12-07 00:04:52.053: D/AndroidRuntime(1013): Shutting down VM
12-07 00:04:52.053: W/dalvikvm(1013): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
12-07 00:04:52.113: E/AndroidRuntime(1013): FATAL EXCEPTION: main
12-07 00:04:52.113: E/AndroidRuntime(1013): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.andreiraileanu.tasker/com.andreiraileanu.tasker.Tasker}: java.lang.ClassNotFoundException: Didn't find class "com.andreiraileanu.tasker.Tasker" on path: /data/app/com.andreiraileanu.tasker-1.apk
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.os.Handler.dispatchMessage(Handler.java:99)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.os.Looper.loop(Looper.java:137)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-07 00:04:52.113: E/AndroidRuntime(1013): at java.lang.reflect.Method.invokeNative(Native Method)
12-07 00:04:52.113: E/AndroidRuntime(1013): at java.lang.reflect.Method.invoke(Method.java:511)
12-07 00:04:52.113: E/AndroidRuntime(1013): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-07 00:04:52.113: E/AndroidRuntime(1013): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-07 00:04:52.113: E/AndroidRuntime(1013): at dalvik.system.NativeStart.main(Native Method)
12-07 00:04:52.113: E/AndroidRuntime(1013): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.andreiraileanu.tasker.Tasker" on path: /data/app/com.andreiraileanu.tasker-1.apk
12-07 00:04:52.113: E/AndroidRuntime(1013): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
12-07 00:04:52.113: E/AndroidRuntime(1013): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-07 00:04:52.113: E/AndroidRuntime(1013): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
12-07 00:04:52.113: E/AndroidRuntime(1013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
12-07 00:04:52.113: E/AndroidRuntime(1013): ... 11 more
的AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
package="com.andreiraileanu.tasker" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_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-sdk android:minSdkVersion="13" android:targetSdkVersion="17"/>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:hardwareAccelerated="true" android:allowBackup="true">
<activity android:name="Tasker" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar" android:configChanges="orientation|screenSize|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:2)
我正在使用他们的代码,只修改了App Name
如果您只更改清单中的名称:
android:name="Tasker"
您将看到这些错误。您需要重命名android:name
指向的类:
public class Tasker ... {
// This: ^^^^^^ must match the manifest
(您需要重构文件以更改文件名。)