gpt4 book ai didi

Android - 兼容性库 v4 异常 (EdgeEffect) java.lang.NoClassDefFoundError : > android. widget.EdgeEffect

转载 作者:行者123 更新时间:2023-12-02 18:06:32 28 4
gpt4 key购买 nike

如果有帮助的话,我也在使用 SherlockActionBar。

触发此异常的行是:setContentView(R.layout.activity);

我正在使用的类扩展了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;

此异常的摘要是:

Caused by: java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) at android.support.v4.widget.EdgeEffectCompat.(EdgeEffectCompat.java:133) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290)

完整的 StackTrace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testapp.androidapp/com.testapp.androidapp.SwipeyTabsActivity}: android.view.InflateException: Binary XML file line #22: Error inflating class android.support.v4.view.ViewPager at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1859) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1062) at 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) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class android.support.v4.view.ViewPager at android.view.LayoutInflater.createView(LayoutInflater.java:606) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) at 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) at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) at com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) at android.app.Activity.performCreate(Activity.java:4434) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) ... 11 more Caused by: 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 more Caused by: java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) at android.support.v4.widget.EdgeEffectCompat.(EdgeEffectCompat.java:133) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) at android.support.v4.view.ViewPager.(ViewPager.java:277) ... 26 more android.view.InflateException: Binary XML file line #22: Error inflating class android.support.v4.view.ViewPager at android.view.LayoutInflater.createView(LayoutInflater.java:606) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) at 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) at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) at com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) at android.app.Activity.performCreate(Activity.java:4434) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1062) at 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) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: 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 more Caused by: java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) at android.support.v4.widget.EdgeEffectCompat.(EdgeEffectCompat.java:133) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) at android.support.v4.view.ViewPager.(ViewPager.java:277) ... 26 more 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) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) at 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) at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) at com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) at android.app.Activity.performCreate(Activity.java:4434) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1062) at 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) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) at android.support.v4.widget.EdgeEffectCompat.(EdgeEffectCompat.java:133) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) at android.support.v4.view.ViewPager.(ViewPager.java:277) ... 26 more java.lang.NoClassDefFoundError: android.widget.EdgeEffect at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(EdgeEffectCompatIcs.java:30) at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(EdgeEffectCompat.java:92) at android.support.v4.widget.EdgeEffectCompat.(EdgeEffectCompat.java:133) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:290) at 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) at 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) at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119) at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) at com.testapp.androidapp.SwipeyTabsActivity.onCreate(SwipeyTabsActivity.java:112) at android.app.Activity.performCreate(Activity.java:4434) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1823) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1875) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1062) at 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) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method)

最佳答案

如果您在 LogCat 中向上滚动到异常发生之前的位置,您将看到一行内容类似于 无法找到该类的父类(super class)

您会收到此错误的原因只有三个:

  1. 这个类确实不存在。如果您使用官方示例中的代码并获取此代码,请确保您拥有该库的最新版本
  2. 您尚未将 jar 添加到构建路径中。要解决此问题,请右键单击 Eclipse 中的 jar,然后执行“构建路径”►“添加到构建路径”。
  3. 您的 jar 不在/libs 文件夹中。当您已将 jar 添加到构建路径,但较新版本的 ADT 需要它位于/libs 中时,就会发生这种情况。将其放在那里并将其重新添加到构建路径中。

关于Android - 兼容性库 v4 异常 (EdgeEffect) java.lang.NoClassDefFoundError : > android. widget.EdgeEffect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12008410/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com