gpt4 book ai didi

在 Eclipse 中找不到 android.support.design.widget.coordinatorlayout

转载 作者:行者123 更新时间:2023-11-29 17:33:07 25 4
gpt4 key购买 nike

我正在使用 eclipse,当我运行我的项目时出现以下错误。

08-04 17:12:25.596: E/AndroidRuntime(4175): FATAL EXCEPTION: main
08-04 17:12:25.596: E/AndroidRuntime(4175): java.lang.RuntimeException: Unable to start activity ComponentInfo{me.declangao.wordpressreader/me.declangao.wordpressreader.app.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.os.Handler.dispatchMessage(Handler.java:99)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.os.Looper.loop(Looper.java:137)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-04 17:12:25.596: E/AndroidRuntime(4175): at java.lang.reflect.Method.invokeNative(Native Method)
08-04 17:12:25.596: E/AndroidRuntime(4175): at java.lang.reflect.Method.invoke(Method.java:525)
08-04 17:12:25.596: E/AndroidRuntime(4175): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-04 17:12:25.596: E/AndroidRuntime(4175): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-04 17:12:25.596: E/AndroidRuntime(4175): at dalvik.system.NativeStart.main(Native Method)
08-04 17:12:25.596: E/AndroidRuntime(4175): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
08-04 17:12:25.596: E/AndroidRuntime(4175): at me.declangao.wordpressreader.app.PostFragment.onCreateView(PostFragment.java:72)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.Activity.performStart(Activity.java:5143)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
08-04 17:12:25.596: E/AndroidRuntime(4175): ... 11 more
08-04 17:12:25.596: E/AndroidRuntime(4175): Caused by: java.lang.reflect.InvocationTargetException
08-04 17:12:25.596: E/AndroidRuntime(4175): at java.lang.reflect.Constructor.constructNative(Native Method)
08-04 17:12:25.596: E/AndroidRuntime(4175): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
08-04 17:12:25.596: E/AndroidRuntime(4175): ... 24 more
08-04 17:12:25.596: E/AndroidRuntime(4175): Caused by: java.lang.NoClassDefFoundError: android.support.design.R$styleable
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:168)
08-04 17:12:25.596: E/AndroidRuntime(4175): at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:162)

最佳答案

  • 在您的应用程序库文件夹中包含 android-support-design.jar 和 android-support-v4.jar。
  • 将设计库导入 Eclipse,位于 \extras\android\support\design。
  • 打开项目的属性 -> android -> (Library) Add... -> 选择 design。
  • 你应该改变
public class YourActivity extends Activity {
}

public class YourActivity extends AppCompatActivity {    
}
  • AndroidManifest.xml 并将应用程序的主题更改为
@style/Theme.AppCompat

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat">

关于在 Eclipse 中找不到 android.support.design.widget.coordinatorlayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31808430/

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