java.lang.NoClassDefFoundError的:android.support.v7.app.AppCompatDelegateImplV14 Android Studio中 [英] java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14 in Android Studio

查看:1458
本文介绍了java.lang.NoClassDefFoundError的:android.support.v7.app.AppCompatDelegateImplV14 Android Studio中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的日志。

java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:93)
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:429)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
        at com.marshall.gruppo.ui.MainScreenActivity.onCreate(MainScreenActivity.java:41)
        at android.app.Activity.performCreate(Activity.java:5451)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
        at android.app.ActivityThread.access$900(ActivityThread.java:175)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5602)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
        at dalvik.system.NativeStart.main(Native Method)

我也看过一篇文章暗示溶液(<一个href=\"http://stackoverflow.com/questions/30920044/java-lang-noclassdeffounderror-android-support-v7-app-appcompatdelegateimplv14\">java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14 )。这表明我补充的文件的build.gradle以下。

I also read an article suggesting the solution (java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14). It suggests me to add the following in the build.gradle file.

compile 'com.android.support:appcompat-v7:22.2.0'

其实这已经是该文件中,而且好像这不是原来的问题在这里。这是我的build.gradle文件。

Actually that was already in the file, and it seems like it's not the original issue here. Here is my build.gradle file.

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':volley')
compile project(':android-support-v4')
}

在情况下,你需要有一个看看我的code,这是我的code是引起NoClassDefFoundError的。

In case you need to have a look at my code, here's my code that is causing the NoClassDefFoundError.

public class MainScreenActivity extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;

private CharSequence mTitle;

private String[] navMenuTitles;
private TypedArray navMenuIcons;

private ArrayList<NavDrawerItem> navDrawerItems;
private NavDrawerListAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mainscreen);

    mTitle = mDrawerTitle = getTitle();

    navMenuTitles = getResources().getStringArray(R.array.drawermenu_items);

    navMenuIcons = getResources()
            .obtainTypedArray(R.array.drawermenu_icons);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.list_slidermenu);

    navDrawerItems = new ArrayList<NavDrawerItem>();

    navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
    navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
    navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1)));
    navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1), true, "22"));
    navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
    navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1), true, "50+"));


    navMenuIcons.recycle();

    mDrawerList.setOnItemClickListener(new SlideMenuClickListener());

    adapter = new NavDrawerListAdapter(getApplicationContext(),
            navDrawerItems);
    mDrawerList.setAdapter(adapter);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) {
        public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            invalidateOptionsMenu();
        }

        public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu();
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
        displayView(0);
    }
}

下面是附加的错误日志。有可能是该解决方案的提示。

Here's the additional error log. There might be a hint for the solution.

07-06 17:50:03.056  27850-27850/com.marshall.gruppo E/dalvikvm﹕ Could not find class 'android.support.v7.app.AppCompatDelegateImplV14', referenced from method android.support.v7.app.AppCompatDelegate.create
07-06 17:50:03.056  27850-27850/com.marshall.gruppo E/dalvikvm﹕ Could not find class 'android.support.v7.app.AppCompatDelegateImplV11', referenced from method android.support.v7.app.AppCompatDelegate.create
07-06 17:50:03.056  27850-27850/com.marshall.gruppo E/dalvikvm﹕ Could not find class 'android.support.v7.app.AppCompatDelegateImplV7', referenced from method android.support.v7.app.AppCompatDelegate.create

和这里是该活动的XML文件。

and here's the xml file for the activity.

<?xml version="1.0" encoding="UTF-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@color/list_divider"
    android:dividerHeight="1dp"
    android:listSelector="@drawable/list_selector"
    android:background="@color/list_background"/>

推荐答案

有可能是您的依赖关系的冲突

there might be a conflict with your dependencies

尝试删除

compile project(':android-support-v4')

这篇关于java.lang.NoClassDefFoundError的:android.support.v7.app.AppCompatDelegateImplV14 Android Studio中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆