Android应用无法在模拟器或设备中启动

时间:2013-09-23 17:27:53

标签: android

我终于完成了我的应用程序,一切正常。我回去添加admob的东西,现在它不会在模拟器中启动。它说它成功地在模拟器上安装了应用程序,但它没有启动,并且尝试手动运行时图标不可见。我认为清单是我的错误所在,但我不确定。

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

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.WAKE_LOCK" >
</uses-permission>
<uses-permission android:name="android.permission.Internet" >
</uses-permission>
<uses-permission android:name="android.permission.Write_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity 
        android:name="com.google.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation"

    ></activity>
      <activity
        android:name=".Splash"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Dialog" >
        <intent-filter>
            <action android:name="com.AndroidSleepMachine.gamble.SPLASH" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.AndroidSleepMachine.gamble.HOME"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".About"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Dialog" >
        <intent-filter>
            <action android:name="com.AndroidSleepMachine.gamble.ABOUT" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity android:name="com.androidsleepmachine.gamble.Ship" />
    <activity android:name="com.androidsleepmachine.gamble.OceanThunder" />
    <activity android:name="com.androidsleepmachine.gamble.Ocean" />
    <activity android:name="com.androidsleepmachine.gamble.Forest" />
    <activity android:name="com.androidsleepmachine.gamble.Rain" />
    <activity android:name="com.androidsleepmachine.gamble.Thunderbirds" />
    <activity android:name="com.androidsleepmachine.gamble.Meditation" />
    <activity android:name="com.androidsleepmachine.gamble.Focus" />
    <activity android:name="com.androidsleepmachine.gamble.Pain" />
</application>

</manifest>

logcat文件

09-23 13:17:47.582: E/AndroidRuntime(1563): FATAL EXCEPTION: main
09-23 13:17:47.582: E/AndroidRuntime(1563): java.lang.RuntimeException: Unable to         
instantiate activity  
ComponentInfo{com.androidsleepmachine.gamble/com.AndroidSleepMachine.gamble.HOME}: 
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread.access$600(ActivityThread.java:130)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.os.Looper.loop(Looper.java:137)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread.main(ActivityThread.java:4745)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
java.lang.reflect.Method.invokeNative(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
java.lang.reflect.Method.invoke(Method.java:511)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at  
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
dalvik.system.NativeStart.main(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563): Caused by: 
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563):     at  
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-23 13:17:47.582: E/AndroidRuntime(1563):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)

2 个答案:

答案 0 :(得分:1)

您的主要活动名称似乎不正确。 Java区分大小写,您的应用程序包名称为

package="com.androidsleepmachine.gamble"

,而您的主要活动类名称为

com.AndroidSleepMachine.gamble.HOME

抛出ClassNotFoundException,因为清单中的Activity类名称不正确,并且类加载器找不到它。

答案 1 :(得分:0)

找不到名为:

的班级
  

com.AndroidSleepMachine.gamble.HOME

为什么“AndroidSleepMachine”使用大写字母?

为什么不使用:

  

机器人:名称= “HOME”

...如果你的班级确实叫做HOME.java? 区分大小写可能会导致您的问题。

com.AndroidSleepMachine.gamble.HOMEcom.androidsleepmachine.gamble.HOME

不同