IBM Worklight - 尝试在Android设备中打开应用程序时出现异常

时间:2013-06-17 15:50:59

标签: android android-activity runtime-error ibm-mobilefirst

我对Worklight完全不熟悉,我正在帮助开发一个在CVS上共享的项目。第一次,我的合作帮助我设置了一切,应用程序在我的三星SII 2.3版手机上运行正常。但是在我没有更改应用程序的名称并弄乱代码之后。我从CVS重新下载项目,我无法打开应用程序,它迫使我关闭它。

以下是错误日志:

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

我对类似的情况进行了一些研究,大多数人说这是因为没有将活动名称添加到AndroidManifest.xml,但是,我不知道或者认为我有额外的活动名称需要被覆盖

那么,有人可以提供帮助吗?

的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> 

1 个答案:

答案 0 :(得分:3)

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

fix the issue,请按以下步骤操作:

  1. 右键单击生成的Android项目,然后选择“属性”。
  2. 从左侧窗格中,选择“Java Build Path”
  3. 勾选“Android私立图书馆”复选框
  4. 刷新项目/重新构建应用
  5. 至于更改应用程序的名称,请参阅此SO问题中的说明:IBM Worklight - how to rename an application and change its icon, splash image