user2494027
user2494027

Reputation: 3

IBM Worklight - exception when trying to open application in Android device

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> 

Upvotes: 0

Views: 620

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

In addition to what I have mentioned in my comment to your question, the most common cause to this is using Worklight 5.0.5/6.x in conjunction with ADT v22.

To fix the issue, follow these steps:

  1. Right-click on your generated Android project and choose "properties".
  2. From the left pane, choose "Java Build Path'
  3. Tick the "Android Private Libraries" checkbox
  4. Refresh the project / re-build the app

As for changing the name of the application, see instructions in this SO question: IBM Worklight - how to rename an application and change its icon, splash image

Upvotes: 3

Related Questions