gpt4 book ai didi

java.lang.NoClassDefFoundError : android. support.v7.app.AppCompatDelegateImplV14 在Android Studio

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:09:48 32 4
gpt4 key购买 nike

这是日志。

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)

我还阅读了一篇建议解决方案的文章 ( java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14 )。它建议我在 build.gradle 文件中添加以下内容。

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

实际上这已经在文件中了,看起来这不是这里的原始问题。这是我的 build.gradle 文件。

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

如果您需要查看我的代码,这是导致 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);
}
}

这是额外的错误日志。可能会有解决方案的提示。

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

这是 Activity 的 xml 文件。

<?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"/>

最佳答案

可能与你的依赖有冲突

尝试移除

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

关于java.lang.NoClassDefFoundError : android. support.v7.app.AppCompatDelegateImplV14 在Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31249828/

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