“不幸的是,myapp已停止”android模拟器错误

时间:2012-06-14 15:09:23

标签: android android-layout android-emulator

我收到错误"不幸的是,myapp已停止"当我试图打开一个通过Android模拟器上的eclipse安装的应用程序。这是我的文件

java文件:

@Override
public void onStart() {
    super.onStart();
    try {
        // Initialized SDKs that need to; pass in publisher ids
        Map<SDKAdNetwork, String> publisherIds = new HashMap<SDKAdNetwork, String>();
        publisherIds.put(SDKAdNetwork.GREYSTRIPE, "486417");
        if (medialetsInitialized == false) {
            publisherIds.put(SDKAdNetwork.MEDIALETS,
                    "PutYourIDHere");
        }
        AdMarvelView.initialize(this, publisherIds, handler);

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    // your code
}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();

    try {
        // Initialized SDKs that need to; pass in publisher ids
        Map<SDKAdNetwork, String> publisherIds = new HashMap<SDKAdNetwork, String>();
        publisherIds.put(SDKAdNetwork.GREYSTRIPE, "486417");
        publisherIds.put(SDKAdNetwork.MEDIALETS,
                "PutYourIDHere");

        AdMarvelView.pause(this, publisherIds);

        AdMarvelView adMarvelView = (AdMarvelView) findViewById(R.id.ad);
        if (adMarvelView != null) {
            adMarvelView.flush();
        }

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();

    try {
        // Initialized SDKs that need to; pass in publisher ids
        Map<SDKAdNetwork, String> publisherIds = new HashMap<SDKAdNetwork, String>();
        publisherIds.put(SDKAdNetwork.GREYSTRIPE, "486417");
        publisherIds.put(SDKAdNetwork.MEDIALETS,
                "PutYourIDHere");

        AdMarvelView.resume(this, publisherIds);

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

@Override
public void onStop() {
    super.onStop();

    try {
        Map<SDKAdNetwork, String> publisherIds = new HashMap<SDKAdNetwork, String>();
        publisherIds.put(SDKAdNetwork.GREYSTRIPE, "486417");
        if (medialetsInitialized == true) {
            publisherIds.put(SDKAdNetwork.MEDIALETS,
                    "PutYourIDHere");
            medialetsInitialized = false;
        }
        AdMarvelView.uninitialize(this, publisherIds);

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // your code
}

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    handler = new AdMarvelInitializedHandler();

    final Button button = (Button) findViewById(R.id.Button01);

    final EditText editText01 = (EditText) findViewById(R.id.EditText01);

    final EditText editText02 = (EditText) findViewById(R.id.EditText02);

    final EditText editText03 = (EditText) findViewById(R.id.EditText03);

    AdMarvelView adMarvelView = (AdMarvelView) findViewById(R.id.ad);
    adMarvelView.setEnableClickRedirect(true);
    adMarvelView.setDisableAnimation(false);
    adMarvelView.setListener(this);
    adMarvelView.setEnableInAppBrowser(true);

    editText01.setText(_partnerId);
    editText02.setText(_siteId);
    editText03.setText(_interstitialSiteId);

    adMarvelInterstitialAds = new AdMarvelInterstitialAds(this, 0,
            0x726D6D, 0x00FF00, 0x000000);

    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            try {
                Map<String, String> targetParams = new HashMap<String, String>();
                // targetParams.put("GEOLOCATION", "37.686668,-77.4510549");
                // targetParams.put("POSTAL_CODE", "94131");

                final EditText editText01 = (EditText) findViewById(R.id.EditText01);
                final EditText editText02 = (EditText) findViewById(R.id.EditText02);

                String partnerId = editText01.getText().toString();
                String siteId = editText02.getText().toString();

                AdMarvelView adMarvelView = (AdMarvelView) findViewById(R.id.ad);
                adMarvelView.requestNewAd(targetParams, partnerId, siteId);
            } catch (Exception e) {
                // TODO Auto-generated catch block

                Log.e("admarvel", e.getStackTrace().toString());
            }

        }

    });

    final Button button2 = (Button) findViewById(R.id.Button02);

    button2.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            Map<String, String> targetParams = new HashMap<String, String>();

            targetParams.put("SIZE", "VIDEOPRE");

            final EditText editText01 = (EditText) findViewById(R.id.EditText01);
            final EditText editText03 = (EditText) findViewById(R.id.EditText03);

            String partnerId = editText01.getText().toString();
            String interstitialSiteId = editText03.getText().toString();

            AdMarvelInterstitialAds
                    .setListener(AdMarvelHelloWorldDemo.this);
            AdMarvelHelloWorldDemo.this.adMarvelInterstitialAds
                    .requestNewInterstitialAd(AdMarvelHelloWorldDemo.this,
                            targetParams, partnerId, interstitialSiteId);

        }

    });

}

public void onClickAd(AdMarvelView adMarvelView, String clickUrl) {
    if (clickUrl != null) {
        Log.e("admarvel", "ClickUrl: " + clickUrl);
    }

}

public void onFailedToReceiveAd(AdMarvelView adMarvelView, int errorCode,
        ErrorReason errorReason) {
    Log.e("admarvel", "onFailedToReceiveAd; errorCode: " + errorCode
            + " errorReason: " + errorReason.toString());

}

public void onFailedToReceiveInterstitialAd(SDKAdNetwork sdkAdNetwork,
        String publisherid, int errorCode, ErrorReason errorReason) {

    Log.e("admarvel", "onFailedToReceiveInterstitialAd; errorCode: "
            + errorCode + " errorReason: " + errorReason.toString());

}

public void onReceiveAd(AdMarvelView adMarvelView) {
    Log.e("admarvel", "onReceiveAd");
}

public void onRequestAd(AdMarvelView adMarvelView) {
    Log.e("admarvel", "onRequestAd");

}

public void onRequestInterstitialAd() {
    Log.e("admarvel", "onRequestInterstitialAd");
}

public void onReceiveInterstitialAd(SDKAdNetwork sdkAdNetwork,
        String publisherid, AdMarvelAd adMarvelAd) {
    Log.e("admarvel", "onReceiveInterstitialAd");

    adMarvelInterstitialAds.displayInterstitial(this, sdkAdNetwork,
            publisherid, adMarvelAd);
    if (sdkAdNetwork.equals(SDKAdNetwork.ADMARVEL)) {
        // overridePendingTransition(R.anim.fadein, R.anim.fadeout);
    }
}

public void onCloseInterstitialAd() {
    Log.e("admarvel", "onCloseInterstitialAd");
    if (this.adMarvelActivity != null) {
        this.adMarvelActivity.finish();
    } else if (this.adMarvelVideoActivity != null) {
        this.adMarvelVideoActivity.finish();
    }

}

public void onAdmarvelActivityLaunched(AdMarvelActivity a) {
    Log.e("admarvel", "onAdmarvelActivityLaunched");
    this.adMarvelActivity = a;

}

public void onAdMarvelVideoActivityLaunched(AdMarvelVideoActivity a) {
    Log.e("admarvel", "onAdmarvelVideoActivityLaunched");
    this.adMarvelVideoActivity = a;

}

public void onExpand() {
    Log.e("admarvel", "onExpand");

}

public void onClose() {
    Log.e("admarvel", "onClose");

}

private class AdMarvelInitializedHandler implements
        AdMarvelInitializeListener {

    public void onInitialized(SDKAdNetwork adnetwork) {

        if (adnetwork.equals(SDKAdNetwork.MEDIALETS)) {
            medialetsInitialized = true;
        }

    }

}

    }

这是清单文件

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

<application android:icon="@drawable/icon" android:label=""
    android:debuggable="true"  android:configChanges="orientation" >
    <activity android:name=".AdMarvelHelloWorldDemo"
        android:label="">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="com.admarvel.android.ads.AdMarvelActivity"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:configChanges="keyboard|keyboardHidden|orientation"
        >
    </activity>
    <activity android:name="com.admarvel.android.ads.AdMarvelVideoActivity"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:configChanges="keyboard|keyboardHidden|orientation"
        >
    </activity>

    <provider android:name="com.admarvel.android.ads.AdMarvelLocalFileContentProvider"
      android:authorities="com.admarvel.androidhelloworlddemo.AdMarvelLocalFileContentProvider" />

    <!--
        ADMARVEL: If your integrating with Admob, please define this activity
    -->

    <activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation"/>

    <!--
        ADMARVEL: If your integrating with Ivdopia, please define this activity
    -->

    <activity android:name="com.vdopia.client.android.VDOActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
        android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" />

    <!--
        ADMARVEL: If your integrating with Greystripe, please define this
        provider
    -->
    <provider android:name="com.greystripe.android.sdk.AdContentProvider"
        android:authorities="com.admarvel.androidhelloworlddemo.AdContentProvider"
        android:multiprocess="true" android:exported="false" />

    <!--
        ADMARVEL: If your integrating with Medialets, please define this

    -->
    <service android:name="com.medialets.advertising.AdManagerService" />

    <!--
        ADMARVEL: If your integrating with Greystripe, please define this
        activity
    -->
    <activity android:name="com.greystripe.android.sdk.AdView"
        android:configChanges="keyboard|keyboardHidden|orientation">
        <intent-filter>
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <!-- 
        ADMARVEL:  If your integrating with Millennial, please define this
     -->

    <activity android:name="com.millennialmedia.android.MMAdViewOverlayActivity" 
                android:theme="@android:style/Theme.Translucent.NoTitleBar">
    </activity>        
    <activity android:name="com.millennialmedia.android.VideoPlayer" 
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                android:configChanges="keyboardHidden|orientation|keyboard" >
    </activity>

    <!-- 
        ADMARVEL:  If your integrating with Rhythm, please define this
     -->
  <activity android:label="Rhythm Activity"
                        android:theme="@android:style/Theme.Translucent.NoTitleBar"
                        android:configChanges="keyboard|keyboardHidden|orientation"
                        android:name="com.rhythmnewmedia.sdk.RhythmActivity" />
  <activity android:label="Rhythm Video Activity"
                        android:theme="@android:style/Theme.Black.NoTitleBar"
                        android:configChanges="keyboard|keyboardHidden|orientation"
                         android:name="com.rhythmnewmedia.sdk.video.RhythmVideoActivity" />

</application>
<uses-sdk android:minSdkVersion="3" />

<supports-screens android:largeScreens="true"                  
              android:anyDensity="true" />

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

<!-- REQUIRED BY GREYSTRIPE, MEDIALETS, RHYTHM AND MILLENNIAL  -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- REQUIRED BY MEDIALETS -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

    </manifest> 

有人可以帮忙。

编辑:继承了logcat的链接

logcat file

请帮忙!感谢。

1 个答案:

答案 0 :(得分:0)

看起来它正在寻找基于此消息的内容提供商,但它无法找到它(ClassNotFound)

Unable to get provider com.greystripe.android.sdk.AdContentProvider

你在libs文件夹中缺少一个jar吗?

相关问题