如何解决这个RuntimeException?

时间:2014-10-30 15:39:59

标签: android android-activity runtimeexception

我没有得到这个问题,但朋友是这样他给我发了堆栈痕迹,因为他离我太远,我无法检查他的设备。这个问题对我来说似乎很模糊,所以我不确定先检查哪里。我该怎么办?

注意:我已将MainActivity.onCreate附在此跟踪下方

java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxx.android.phone.xxxx/xxxx.android.phone.xxxx.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class shared.ui.actionscontentview.ActionsContentView
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
       at android.app.ActivityThread.access$800(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5221)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class shared.ui.actionscontentview.ActionsContentView
       at android.view.LayoutInflater.createView(LayoutInflater.java:633)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
       at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
       at android.app.Activity.setContentView(Activity.java:2144)
       at xxxx.android.phone.xxxx.MainActivity.onCreate(MainActivity.java:145)
       at android.app.Activity.performCreate(Activity.java:5933)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
       at android.app.ActivityThread.access$800(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5221)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.newInstance(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
       at android.view.LayoutInflater.createView(LayoutInflater.java:607)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
       at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
       at android.app.Activity.setContentView(Activity.java:2144)
       at xxxx.android.phone.xxxx.MainActivity.onCreate(MainActivity.java:145)
       at android.app.Activity.performCreate(Activity.java:5933)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
       at android.app.ActivityThread.access$800(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5221)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.youtube.api.service.START }
       at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
       at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
       at android.app.ContextImpl.bindService(ContextImpl.java:1751)
       at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
       at com.google.android.youtube.player.internal.r.e()
       at com.google.android.youtube.player.YouTubePlayerView.a()
       at com.google.android.youtube.player.YouTubeBaseActivity$a.a()
       at com.google.android.youtube.player.YouTubePlayerView.initialize()
       at xxxx.android.phone.xxxx.MainActivity.initYouTubePlayer(MainActivity.java:509)
       at xxxx.android.phone.xxxx.layout.MainContainer.onFinishInflate(MainContainer.java:73)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:814)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
       at shared.ui.actionscontentview.ActionsContentView.<init>(ActionsContentView.java:217)
       at shared.ui.actionscontentview.ActionsContentView.<init>(ActionsContentView.java:136)
       at java.lang.reflect.Constructor.newInstance(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
       at android.view.LayoutInflater.createView(LayoutInflater.java:607)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
       at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
       at android.app.Activity.setContentView(Activity.java:2144)
       at xxxx.android.phone.xxxx.MainActivity.onCreate(MainActivity.java:145)
       at android.app.Activity.performCreate(Activity.java:5933)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
       at android.app.ActivityThread.access$800(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5221)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

MainActivity.onCreate

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
          this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
          MainActivity.instance = this;
          this.className = this.getClass().getSimpleName();                     

    // get login credentials
    SharedPreferences settings = getSharedPreferences(xxxx.PREFS, 0);
    xxxx.instance.currentUserEmail = settings.getString(xxxx.PREFS_KEY_SAVED_EMAIL, "");
    xxxx.instance.currentUserPassword = settings.getString(xxxx.PREFS_KEY_SAVED_PASSWORD, "");

    if(MainActivity.CACHING_ENABLED) {              
          // set up image cache
           ImageCache.ImageCacheParams imageCacheParams = new ImageCache.ImageCacheParams(getApplicationContext(), IMAGE_CACHE_DIR);
           // Set image memory cache to 1/10th of mem class
           imageCacheParams.setMemCacheSizePercent(this, 0.1f);
           MainActivity._imageCache = new ImageCache(imageCacheParams);

          // set up xml cache
           XMLCache.XMLCacheParams xmlCacheParams = new XMLCache.XMLCacheParams(this, XML_CACHE_DIR);
           // Set xml memory cache to 1/10th of mem class
           xmlCacheParams.setMemCacheSizePercent(this, 0.1f);
           MainActivity._xmlCache = new XMLCache(xmlCacheParams);

           this.checkCacheFreshness();
    }

    Session session = Session.getActiveSession();
    if (session == null) {
        if (savedInstanceState != null) {
            session = Session.restoreSession(this, null, statusCallback, savedInstanceState);
        }
        if (session == null) {
          //session = new Session.Builder(this).setApplicationId(getResources().getString(R.string.facebook_app_id)).build();
            session = new Session(this);
        }
        Session.setActiveSession(session);
        if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) {
            session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
        }
    }

    setContentView(R.layout.app_container);
    navSlider = (ActionsContentView) findViewById(R.id.actionsContentView);

    // use a tree observer and a global layout listener to get the available screen size and height -DJL
       final RelativeLayout fullScreenLayout = (RelativeLayout) findViewById(R.id.fullScreenLayout);
       ViewTreeObserver vto = fullScreenLayout.getViewTreeObserver();
       vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
                 public void onGlobalLayout() {                
                        //remove listener to ensure only one call is made.
                        fullScreenLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                        xxxx.instance.height = fullScreenLayout.getHeight();
                        xxxx.instance.width = fullScreenLayout.getWidth();
                        Log.v(xxxx.TAG, "Height: " + xxxx.instance.height);
                        Log.v(xxxx.TAG, "Width: " + xxxx.instance.width);

                        // Once we have the dimensions we load the featured page
                        Navigation.instance.featuredBtn.performClick();
                 };
          });

    // Load the quick tutorial activity if it has never been loaded
       SharedPreferences prefs = getSharedPreferences(xxxx.PREFS, 0);

 // If the app has been updated, show the tutorial again
          if (xxxx.wasUpdated(getBaseContext())) {
                 SharedPreferences.Editor editor = prefs.edit();
          editor.putString(xxxx.PREFS_KEY_TUTORIAL_SHOWN, "false");
          editor.commit();
          }

          boolean tutShown = Boolean.parseBoolean(prefs.getString(xxxx.PREFS_KEY_TUTORIAL_SHOWN, null));
          //tutShown = false; // uncomment to display the tutorial every launch for testing

    if(!tutShown) {
          Intent intent = new Intent(this, TutorialActivity.class);
          startActivity(intent);
        // update the tutorial show preference
          SharedPreferences.Editor editor = prefs.edit();
          editor.putString(xxxx.PREFS_KEY_TUTORIAL_SHOWN, "true");
          editor.commit();
    }

      boolean shouldPromptCheck = true;
    Bundle bundle = this.getIntent().getExtras();
    if(bundle != null) {
          shouldPromptCheck = bundle.getBoolean(xxxx.KEY_SHOULD_PROMPT_CHECK, true);
    }
    if(shouldPromptCheck) {
              xxxx.instance.performVersionCheck(this);
    }
}

1 个答案:

答案 0 :(得分:0)

我更新了Youtube SDK&amp;的版本。 Google AnalyticsSDK和中提琴。

相关问题