尝试在 Nexus 5x 中运行该应用程序时出现此错误。
\n\n下面是堆栈:
\n\n04-16 22:41:37.083 23199-23199/au.com... E/AndroidRuntime: FATAL EXCEPTION: main\n Process: au.com.beewest.natswarehouse, PID: 23199\n java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.beewest.natswarehouse/au.com....MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\n at android.app.ActivityThread.-wrap11(ActivityThread.java)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:148)\n at android.app.ActivityThread.main(ActivityThread.java:5422)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\n Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout\n at android.view.LayoutInflater.inflate(LayoutInflater.java:539)\n at android.view.LayoutInflater.inflate(LayoutInflater.java:423)\n at android.view.LayoutInflater.inflate(LayoutInflater.java:374)\n at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)\n at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)\n at au.com.beewest.natswarehouse.MainActivity.onCreate(MainActivity.java:26)\n at android.app.Activity.performCreate(Activity.java:6251)\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\xc2\xa0\n at android.app.ActivityThread.-wrap11(ActivityThread.java)\xc2\xa0\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\xc2\xa0\n at android.os.Handler.dispatchMessage(Handler.java:102)\xc2\xa0\n at android.os.Looper.loop(Looper.java:148)\xc2\xa0\n at android.app.ActivityThread.main(ActivityThread.java:5422)\xc2\xa0\n at java.lang.reflect.Method.invoke(Native Method)\xc2\xa0\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\xc2\xa0\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\xc2\xa0\n Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout\n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)\n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)\n at android.view.LayoutInflater.inflate(LayoutInflater.java:492)\n at android.view.LayoutInflater.inflate(LayoutInflater.java:423)\xc2\xa0\n at android.view.LayoutInflater.inflate(LayoutInflater.java:374)\xc2\xa0\n at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)\xc2\xa0\n at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)\xc2\xa0\n at au.com.beewest.natswarehouse.MainActivity.onCreate(MainActivity.java:26)\xc2\xa0\n at android.app.Activity.performCreate(Activity.java:6251)\xc2\xa0\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)\xc2\xa0\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)\xc2\xa0\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\xc2\xa0\n at android.app.ActivityThread.-wrap11(ActivityThread.java)\xc2\xa0\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\xc2\xa0\n at android.os.Handler.dispatchMessage(Handler.java:102)\xc2\xa0\n at android.os.Looper.loop(Looper.java:148)\xc2\xa0\n at android.app.ActivityThread.main(ActivityThread.java:5422)\xc2\xa0\n at java.lang.reflect.Method.invoke(Native Method)\xc2\xa0\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\xc2\xa0\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\xc2\xa0\n Caused by: java.lang.ClassNotFoundException: Didn\'t find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/au.com.beewest.natswarehouse-2/base.apk"],nativeLibraryDirectories=[/data/app/au.com.beewest.natswarehouse-2/lib/arm64, /vendor/lib64, /system/lib64]]\n at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:511)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:469)\n at android.view.LayoutInflater.createView(LayoutInflater.java:583)\n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)\n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)\xc2\xa0\n at android.view.LayoutInflater.inflate(LayoutInflater.java:492)\xc2\xa0\n at android.view.LayoutInflater.inflate(LayoutInflater.java:423)\xc2\xa0\n at android.view.LayoutInflater.inflate(LayoutInflater.java:374)\xc2\xa0\n at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)\xc2\xa0\n at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)\xc2\xa0\n at au.com.beewest.natswarehouse.MainActivity.onCreate(MainActivity.java:26)\xc2\xa0\n at android.app.Activity.performCreate(Activity.java:6251)\xc2\xa0\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)\xc2\xa0\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)\xc2\xa0\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\xc2\xa0\n at android.app.ActivityThread.-wrap11(ActivityThread.java)\xc2\xa0\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\xc2\xa0\n at android.os.Handler.dispatchMessage(Handler.java:102)\xc2\xa0\n at android.os.Looper.loop(Looper.java:148)\xc2\xa0\n at android.app.ActivityThread.main(ActivityThread.java:5422)\xc2\xa0\n at java.lang.reflect.Method.invoke(Native Method)\xc2\xa0\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\xc2\xa0\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\xc2\xa0\n Suppressed: java.lang.ClassNotFoundException: android.support.design.widget.CoordinatorLayout\n at java.lang.Class.classForName(Native Method)\n at java.lang.BootClassLoader.findClass(ClassLoader.java:781)\n at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:504)\n ... 22 more\n Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available\nRun Code Online (Sandbox Code Playgroud)\n\n还有我的 build.gradle
\n\napply plugin: \'com.android.application\'\n\nandroid {\n compileSdkVersion 23\n buildToolsVersion "23.0.2"\n\n defaultConfig {\n applicationId "au.com...."\n minSdkVersion 16\n targetSdkVersion 23\n versionCode 1\n versionName "1.0"\n }\n buildTypes {\n release {\n minifyEnabled false\n proguardFiles getDefaultProguardFile(\'proguard-android.txt\'), \'proguard-rules.pro\'\n }\n }\n}\n\ndependencies {\n compile fileTree(dir: \'libs\', include: [\'*.jar\'])\n testCompile \'junit:junit:4.12\'\n compile \'org.apache.httpcomponents:httpclient:4.5\'\n compile \'com.loopj.android:android-async-http:1.4.9\'\n compile \'com.android.support:appcompat-v7:23.2.1\'\n}\nRun Code Online (Sandbox Code Playgroud)\n
添加compile 'com.android.support:design:23.2.1'到build.gradle解决
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
}
Run Code Online (Sandbox Code Playgroud)
请记住将 23.2.1 更改为您正在使用的构建版本
| 归档时间: |
|
| 查看次数: |
12031 次 |
| 最近记录: |