2015-06-14 68 views
-1

我的應用程序每次在模擬器上運行時都會崩潰。我收到一條消息,說Myapp停止工作。我是android新手,我正在使用android studio。我看了看logcat的輸出,這就是我得到如何在運行應用程序時解決android.view.InflateException

06-12 14:41:21.160 27245-27245/? I/art? Not late-enabling -Xcheck:jni (already on) 
06-12 14:41:21.310 27245-27245/? D/AndroidRuntime? Shutting down VM 
06-12 14:41:21.320 27245-27245/? E/AndroidRuntime? FATAL EXCEPTION: main 
    Process: com.example.machimanapc.btdt, PID: 27245 
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.machimanapc.btdt/com.example.machimanapc.btdt.QuizSplashActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class leanerLayout 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
      at android.app.ActivityThread.access$800(ActivityThread.java:151) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
      at android.os.Handler.dispatchMessage(Handler.java:102) 
      at android.os.Looper.loop(Looper.java:135) 
      at android.app.ActivityThread.main(ActivityThread.java:5257) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
    Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class leanerLayout 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378) 
      at android.app.Activity.setContentView(Activity.java:2145) 
      at com.example.machimanapc.btdt.QuizActivity.onCreate(QuizActivity.java:17) 
      at com.example.machimanapc.btdt.QuizSplashActivity.onCreate(QuizSplashActivity.java:20) 
      at android.app.Activity.performCreate(Activity.java:5990) 
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
            at android.app.ActivityThread.access$800(ActivityThread.java:151) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
            at android.os.Handler.dispatchMessage(Handler.java:102) 
            at android.os.Looper.loop(Looper.java:135) 
            at android.app.ActivityThread.main(ActivityThread.java:5257) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:372) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.leanerLayout" on path: DexPathList[[zip file "/data/app/com.example.machimanapc.btdt-2/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]] 
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 
      at android.view.LayoutInflater.createView(LayoutInflater.java:571) 
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:665) 
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:65) 
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378) 
            at android.app.Activity.setContentView(Activity.java:2145) 
            at com.example.machimanapc.btdt.QuizActivity.onCreate(QuizActivity.java:17) 
            at com.example.machimanapc.btdt.QuizSplashActivity.onCreate(QuizSplashActivity.java:20) 
            at android.app.Activity.performCreate(Activity.java:5990) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
            at android.app.ActivityThread.access$800(ActivityThread.java:151) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
            at android.os.Handler.dispatchMessage(Handler.java:102) 
            at android.os.Looper.loop(Looper.java:135) 
            at android.app.ActivityThread.main(ActivityThread.java:5257) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:372) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
    Suppressed: java.lang.ClassNotFoundException: android.view.leanerLayout 
      at java.lang.Class.classForName(Native Method) 
      at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 
      at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 
      ... 26 more 
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available 
​ 
+0

我想你可能在'xml中拼寫'LinearLayout'爲'leanerLayout'。如果'leanerLayout'是你的自定義視圖,那麼你需要使用完全限定的類名,就像'com.example.leanerLayout'一樣。 –

回答

2

您似乎是在佈局XML文件<leanerLayout>標籤。在Android SDK中沒有任何名稱。如果您創建了自己的leanerLayout子類ViewViewGroup,則需要完整限定類名(例如,<com.tlhani.leanerLayout>而不是<leanerLayout>)。

1

在你QuizSplashActivity內容查看XML文件有語法錯誤,你有leanerLayout,你可能是指LinearLayout

0

問題就出在了Syntex錯誤。謝謝你的幫助。

相關問題