小弟在调试芒果广告时出现错误“The application ...has stopped unexpectedly.”,代码如下:
--------------------------------------------------------------------------------------
package mogot2.x;import com.admogo.AdMogoLayout;
import com.admogo.AdMogoListener;
import com.admogo.AdMogoManager;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.widget.FrameLayout;public class Mogot2Activity extends Activity implements AdMogoListener {

private final String mogoID = "399b65e0b89346c9b59f7ed90fbd5949"; @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/************************ 代码方式添加Banner广告 ***********************/
AdMogoLayout adMogoLayoutCode = new AdMogoLayout(this, mogoID);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
// 设置广告出现的位置(悬浮于底部)
params.bottomMargin = 0;
// 添加广告状态监听

params.gravity = Gravity.BOTTOM;
addContentView(adMogoLayoutCode, params);
/*************************** 添加Banner广告结束 ************************/
} @Override
public void onClickAd() {
Log.v("=onClickAd=", "Click the buttom ad.");
} @Override
public void onFailedReceiveAd() {
Log.v("=onFailedReceiveAd=", "Failed to receive the buttom ad.");
} @Override
public void onReceiveAd() {
Log.v("=onReceiveAd=", "Receive the buttom ad.");
} @Override
protected void onDestroy() {
AdMogoManager.clear();
super.onDestroy();
}}
-------------------------------------------------------------------------------------
备注:同样的代码在芒果给出的例子上调试没有任何错误,但自己另外创建一个应用,然后将以上代码复制上去,就会出现错误“The application ...has stopped unexpectedly.”

解决方案 »

  1.   


    10-27 08:31:36.221: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
    10-27 08:31:36.221: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory)
    10-27 08:31:36.221: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
    10-27 08:31:36.221: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory)
    10-27 08:31:45.171: ERROR/MemoryHeapBase(51): error opening /dev/pmem: No such file or directory
    10-27 08:31:45.171: ERROR/SurfaceFlinger(51): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
    10-27 08:31:45.271: ERROR/libEGL(51): couldn't load <libhgl.so> library (Cannot load library: load_library[984]: Library 'libhgl.so' not found)
    10-27 08:31:45.611: ERROR/libEGL(62): couldn't load <libhgl.so> library (Cannot load library: load_library[984]: Library 'libhgl.so' not found)
    10-27 08:31:48.391: ERROR/BatteryService(51): Could not open '/sys/class/power_supply/usb/online'
    10-27 08:31:48.391: ERROR/BatteryService(51): Could not open '/sys/class/power_supply/battery/batt_vol'
    10-27 08:31:48.391: ERROR/BatteryService(51): Could not open '/sys/class/power_supply/battery/batt_temp'
    10-27 08:31:48.781: ERROR/EventHub(51): could not get driver version for /dev/input/mouse0, Not a typewriter
    10-27 08:31:48.781: ERROR/EventHub(51): could not get driver version for /dev/input/mice, Not a typewriter
    10-27 08:31:48.991: ERROR/System(51): Failure starting core service
    10-27 08:31:48.991: ERROR/System(51): java.lang.SecurityException
    10-27 08:31:48.991: ERROR/System(51):     at android.os.BinderProxy.transact(Native Method)
    10-27 08:31:48.991: ERROR/System(51):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
    10-27 08:31:48.991: ERROR/System(51):     at android.os.ServiceManager.addService(ServiceManager.java:72)
    10-27 08:31:48.991: ERROR/System(51):     at com.android.server.ServerThread.run(SystemServer.java:162)
    10-27 08:31:48.991: ERROR/AndroidRuntime(51): Crash logging skipped, no checkin service
    10-27 08:31:50.072: ERROR/LockPatternKeyguardView(51): Failed to bind to GLS while checking for account
    10-27 08:31:50.151: ERROR/jdwp(103): Failed sending req to debugger: Broken pipe (-1 of 27)
    10-27 08:31:50.151: ERROR/jdwp(103): Failed sending req to debugger: Broken pipe (-1 of 27)
    10-27 08:31:50.192: ERROR/jdwp(103): Failed sending reply to debugger: Broken pipe
    10-27 08:31:52.451: ERROR/ActivityThread(105): Failed to find provider info for com.google.settings
    10-27 08:31:52.492: ERROR/ActivityThread(105): Failed to find provider info for com.google.settings
    10-27 08:31:55.152: ERROR/ApplicationContext(51): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
    10-27 08:31:58.151: ERROR/vold(26): Cannot start volume '/sdcard' (volume is not bound)
    10-27 08:32:03.947: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
    10-27 08:32:05.528: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
    10-27 08:32:05.558: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
    10-27 08:32:06.168: ERROR/MediaPlayerService(30): Couldn't open fd for content://settings/system/notification_sound
    10-27 08:32:06.168: ERROR/MediaPlayer(51): Unable to to create media player
    10-27 08:32:06.707: ERROR/AndroidRuntime(181): Uncaught handler: thread main exiting due to uncaught exception
    10-27 08:32:06.758: ERROR/AndroidRuntime(181): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mogot2.x/mogot2.x.DemoActivity}: java.lang.ClassNotFoundException: mogot2.x.DemoActivity in loader dalvik.system.PathClassLoader@43757e60
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2324)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.os.Handler.dispatchMessage(Handler.java:99)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.os.Looper.loop(Looper.java:123)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread.main(ActivityThread.java:4203)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at java.lang.reflect.Method.invokeNative(Native Method)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at java.lang.reflect.Method.invoke(Method.java:521)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at dalvik.system.NativeStart.main(Native Method)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181): Caused by: java.lang.ClassNotFoundException: mogot2.x.DemoActivity in loader dalvik.system.PathClassLoader@43757e60
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
    10-27 08:32:06.758: ERROR/AndroidRuntime(181):     ... 11 more
      

  2.   

    Caused by: java.lang.ClassNotFoundException: mogot2.x.DemoActivity