如果有帮助,我也会使用SherlockActionBar。
触发此异常的行是:setContentView(R.layout.activity);
我使用extends SherlockFragmentActivity
应用程序名称为com.testapp.androidapp
,类是:com.testapp.androidapp.SwipeyTabsActivity。
我已经在一些手机上尝试过这个应用程序了,除了这台设备之外,Nexus S.除了所有设备都报告了Android的实际版本号(4.0.1,2.3.3) ,这是唯一具有命名版本的设备(IceCreamSandwich)。
问题是,如何确保此错误不会发生?如果有帮助,我不需要效果(EdgeEffect)。
这些是我的进口商品:
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Window;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.MenuItem.OnActionExpandListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
此例外的摘要是:
引起:java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) 在 android.support.v4.widget.EdgeEffectCompat $ EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) 在 android.support.v4.widget.EdgeEffectCompat。(EdgeEffectCompat.java:133) 在 android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290)
完整的StackTrace:
java.lang.RuntimeException:无法启动活动 ComponentInfo {com.testapp.androidapp / com.testapp.androidapp.SwipeyTabsActivity}: android.view.InflateException:二进制XML文件行#22:错误 膨胀类android.support.v4.view.ViewPager at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1859) 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) 在android.app.ActivityThread.access $ 600(ActivityThread.java:122)at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1062) 在android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4215)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(Native方法)引起: android.view.InflateException:二进制XML文件行#22:错误 膨胀类android.support.v4.view.ViewPager at android.view.LayoutInflater.createView(LayoutInflater.java:606)at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:739)at android.view.LayoutInflater.inflate(LayoutInflater.java:489)at android.view.LayoutInflater.inflate(LayoutInflater.java:396)at android.view.LayoutInflater.inflate(LayoutInflater.java:352)at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:244) 在 com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) 在 com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) 在 com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) 在android.app.Activity.performCreate(Activity.java:4434)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) ... 11更多引起:java.lang.reflect.InvocationTargetException 在java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:417)at android.view.LayoutInflater.createView(LayoutInflater.java:586)... 23更多引起:java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) 在 android.support.v4.widget.EdgeEffectCompat $ EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) 在 android.support.v4.widget.EdgeEffectCompat。(EdgeEffectCompat.java:133) 在 android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) 在android.support.v4.view.ViewPager。(ViewPager.java:277)... 26更多android.view.InflateException:二进制XML文件行#22:错误 膨胀类android.support.v4.view.ViewPager at android.view.LayoutInflater.createView(LayoutInflater.java:606)at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:739)at android.view.LayoutInflater.inflate(LayoutInflater.java:489)at android.view.LayoutInflater.inflate(LayoutInflater.java:396)at android.view.LayoutInflater.inflate(LayoutInflater.java:352)at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:244) 在 com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) 在 com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) 在 com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) 在android.app.Activity.performCreate(Activity.java:4434)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) 在android.app.ActivityThread.access $ 600(ActivityThread.java:122)at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1062) 在android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4215)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(Native方法)引起: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:417)at android.view.LayoutInflater.createView(LayoutInflater.java:586)... 23更多引起:java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) 在 android.support.v4.widget.EdgeEffectCompat $ EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) 在 android.support.v4.widget.EdgeEffectCompat。(EdgeEffectCompat.java:133) 在 android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) 在android.support.v4.view.ViewPager。(ViewPager.java:277)... 另外26个java.lang.reflect.InvocationTargetException java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:417)at android.view.LayoutInflater.createView(LayoutInflater.java:586)at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:739)at android.view.LayoutInflater.inflate(LayoutInflater.java:489)at android.view.LayoutInflater.inflate(LayoutInflater.java:396)at android.view.LayoutInflater.inflate(LayoutInflater.java:352)at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:244) 在 com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) 在 com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) 在 com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) 在android.app.Activity.performCreate(Activity.java:4434)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) 在android.app.ActivityThread.access $ 600(ActivityThread.java:122)at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1062) 在android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4215)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(Native方法)引起: java.lang.NoClassDefFoundError:android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) 在 android.support.v4.widget.EdgeEffectCompat $ EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) 在 android.support.v4.widget.EdgeEffectCompat。(EdgeEffectCompat.java:133) 在 android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) 在android.support.v4.view.ViewPager。(ViewPager.java:277)... 另外26个java.lang.NoClassDefFoundError:android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) 在 android.support.v4.widget.EdgeEffectCompat $ EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) 在 android.support.v4.widget.EdgeEffectCompat。(EdgeEffectCompat.java:133) 在 android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) 在android.support.v4.view.ViewPager。(ViewPager.java:277)at java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:417)at android.view.LayoutInflater.createView(LayoutInflater.java:586)at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:739)at android.view.LayoutInflater.inflate(LayoutInflater.java:489)at android.view.LayoutInflater.inflate(LayoutInflater.java:396)at android.view.LayoutInflater.inflate(LayoutInflater.java:352)at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:244) 在 com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) 在 com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) 在 com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) 在android.app.Activity.performCreate(Activity.java:4434)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) 在android.app.ActivityThread.access $ 600(ActivityThread.java:122)at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1062) 在android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4215)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(原生方法)
答案 0 :(得分:6)
如果您在发生异常之前将LogCat向上滚动一点,您会看到类似Unable to find the superclass for that class
的行。
您遇到此错误的原因只有三个: