0

I am totally new to Worklight, and I am helping to work on a project which is shared on CVS. First time, my co-work help me set up everything and the app runs okay on my Samsung SII 2.3 version phone. But after I failed to change the apps' name and mess up the code. I re-download the project from CVS, I can't open the apps anymore and it forced me to close it.

Here is the error log:

06-17 11:33:26.893: E/AndroidRuntime(22113): FATAL EXCEPTION: main
06-17 11:33:26.893: E/AndroidRuntime(22113): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.MCLM/com.MCLM.MCLM}: java.lang.ClassNotFoundException: com.MCLM.MCLM in loader dalvik.system.PathClassLoader[/data/app/com.MCLM-1.apk]
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.os.Looper.loop(Looper.java:130)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread.main(ActivityThread.java:3691)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at java.lang.reflect.Method.invokeNative(Native Method)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at java.lang.reflect.Method.invoke(Method.java:507)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at dalvik.system.NativeStart.main(Native Method)
06-17 11:33:26.893: E/AndroidRuntime(22113): Caused by: java.lang.ClassNotFoundException: com.MCLM.MCLM in loader dalvik.system.PathClassLoader[/data/app/com.MCLM-1.apk]
06-17 11:33:26.893: E/AndroidRuntime(22113):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-17 11:33:26.893: E/AndroidRuntime(22113):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
06-17 11:33:26.893: E/AndroidRuntime(22113):    ... 11 more

I did some research about the similar situation, and most ppl said that will be caused by not adding the activity name to the AndroidManifest.xml, however, I don't know or think I have extra activity name need to be covered.

So, someone can help?

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.MCLM"      
        android:versionCode="1"
        android:versionName="1.0">    

    <supports-screens
        android:smallScreens="false"
        android:normalScreens="true"
        android:largeScreens="false"
        android:resizeable="false"
        android:anyDensity="false"
        />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>


    <!-- Push permissions -->
    <permission android:name="com.MCLM.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="com.MCLM.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>


    <application 
        android:label="@string/app_name" 
        android:debuggable="true"
        android:icon="@drawable/icon" >
        <activity android:name=".MCLM"
                  android:label="@string/app_name" 
                  android:configChanges="orientation|keyboardHidden"
                  android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.MCLM.MCLM.NOTIFICATION" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- Preference Activity  -->
        <activity
            android:name="com.worklight.common.WLPreferences"
            android:label="Worklight Settings">
        </activity>
        <!-- Push service  -->
        <!-- In order to use the c2dm library, an application must declare a class with the name C2DMReceiver, in its own package, extending com.google.android.c2dm.C2DMBaseReceiver 
            It must also include this section in the manifest, replacing "com.google.android.apps.chrometophone" with its package name. -->
        <service android:name=".GCMIntentService" />

        <!-- Only google service can send data messages for the app. If permission is not set - any other app can generate it -->
        <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <!-- Receive the actual message -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.MCLM" />
            </intent-filter>
            <!-- Receive the registration id -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.MCLM" />
            </intent-filter>
        </receiver>
    </application>
    <uses-sdk android:minSdkVersion="8" />
</manifest> 
4

1 回答 1

3

除了我在对您的问题的评论中提到的内容之外,最常见的原因是将 Worklight 5.0.5/6.x 与 ADT v22 结合使用。

解决此问题,请执行以下步骤:

  1. 右键单击您生成的 Android 项目并选择“属性”。
  2. 从左侧窗格中,选择“Java Build Path”
  3. 勾选“Android 私有库”复选框
  4. 刷新项目/重新构建应用程序

至于更改应用程序的名称,请参阅此 SO 问题中的说明:IBM Worklight - 如何重命名应用程序并更改其图标,启动图像

于 2013-06-17T16:25:01.053 回答