2012-06-14 81 views
0

我收到错误“不幸的是,MYAPP已经停止”当我试图打开它通过安装Eclipse在Android emulator.here的应用程序是我的文件“不幸的是,MYAPP已停止”的Android模拟器错误

的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

请帮助!谢谢。

+0

你可以发布日志吗 –

+1

发布你的logcat跟踪。 – Mxyk

+0

@Mike盖茨我如何采取logcat日志,对不起,我是新来的这一切。 – user1207289

回答

0

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

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

是否缺少libs文件夹中一个罐子?

+0

我认为现在错误已经消失,但有一个比较错误'java.lang.IllegalStateException:问题解析idx 1'继承人链接到新的logcat [新logcat](https://docs.google.com/document/pub? ID = 1R8jgfDlBzy8Xdn8hswhzNwRHmIZrhRuIOZ9IAb_VICQ)。谢谢! – user1207289

+0

你使用的是自定义的android ROM吗?我能够找到与你的错误有关的东西...检查了这一点... http://stackoverflow.com/questions/8241068/weird-exceptions-under-android-4-0-with-eclipse – stuckless

+0

尽可能我有限的知识继续这些东西,我没有使用任何自定义ROM。我的模拟器Android版本是4.0.3。重申一下,当我点击模拟器中已安装的应用程序时,我收到了“不幸的是,应用程序已停止”错误。继承人截图[截图](https://docs.google.com/document/pub?id=13i3NhK2bupxn8NaOF9qko9pRiL6l7aOdE_EKNnmqy8A)。谢谢你的帮助! – user1207289

相关问题