简体   繁体   中英

Android App crashed when i try to open it

I am building a Calendar app which will store events through sqlite database when i finished building it is always crashing for some reason and i don't know where the errors at.

This is my logcat

              --------- beginning of crash
     E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.mobile.aaron.aaroncalendar, PID: 25587
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobile.aaron.aaroncalendar/com.mobile.aaron.aaroncalendar.CustomCalendarActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.mobile.aaron.aaroncalendar.CalendarCustomView
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2600)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2682)
                  at android.app.ActivityThread.-wrap11(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496)
                  at android.os.Handler.dispatchMessage(Handler.java:111)
                  at android.os.Looper.loop(Looper.java:207)
                  at android.app.ActivityThread.main(ActivityThread.java:5777)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
               Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.mobile.aaron.aaroncalendar.CalendarCustomView
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412)
                  at android.app.Activity.setContentView(Activity.java:2229)
                  at com.mobile.aaron.aaroncalendar.CustomCalendarActivity.onCreate(CustomCalendarActivity.java:11)
                  at android.app.Activity.performCreate(Activity.java:6347)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2547)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2682) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5777) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
               Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.mobile.aaron.aaroncalendar.CalendarCustomView
                  at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                  at android.app.Activity.setContentView(Activity.java:2229) 
                  at com.mobile.aaron.aaroncalendar.CustomCalendarActivity.onCreate(CustomCalendarActivity.java:11) 
                  at android.app.Activity.performCreate(Activity.java:6347) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2547) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2682) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5777) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
               Caused by: java.lang.reflect.InvocationTargetException
                  at java.lang.reflect.Constructor.newInstance(Native Method)
                  at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                  at android.app.Activity.setContentView(Activity.java:2229) 
                  at com.mobile.aaron.aaroncalendar.CustomCalendarActivity.onCreate(CustomCalendarActivity.java:11) 
                  at android.app.Activity.performCreate(Activity.java:6347) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2547) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2682) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5777) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
               Caused by: com.readystatesoftware.sqliteasset.SQLiteAssetHelper$SQLiteAssetException: Missing databases/events file (or .zip, .gz archive) in assets, or target folder not writable
                  at android.content.res.AssetManager.openAsset(Native Method)
                  at android.content.res.AssetManager.open(AssetManager.java:325)
                  at android.content.res.AssetManager.open(AssetManager.java:299)
                  at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:436)
                  at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400)
                  at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176)
                  at com.mobile.aaron.aaroncalendar.database.DatabaseObject.<init>(DatabaseObject.java:10)
                  at com.mobile.aaron.aaroncalendar.database.DatabaseQuery.<init>(DatabaseQuery.java:0)
                  at com.mobile.aaron.aaroncalendar.CalendarCustomView.setUpCalendarAdapter(CalendarCustomView.java:89)
                  at com.mobile.aaron.aaroncalendar.CalendarCustomView.<init>(CalendarCustomView.java:43)
                  at java.lang.reflect.Constructor.newInstance(Native Method) 
                  at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                  at android.app.Activity.setContentView(Activity.java:2229) 
                  at com.mobile.aaron.aaroncalendar.CustomCalendarActivity.onCreate(CustomCalendarActivity.java:11) 
                  at android.app.Activity.performCreate(Activity.java:6347) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2547) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2682) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1496) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5777) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 

This is my layout

activity_custom_calendar.xml

<?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_custom_calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.mobile.aaron.aaroncalendar.CustomCalendarActivity">
<com.mobile.aaron.aaroncalendar.CalendarCustomView
    android:id="@+id/custom_calendar"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</com.mobile.aaron.aaroncalendar.CalendarCustomView>
</LinearLayout>

Can you help me where the errors at? I am new to android thanks

The root cause is written

Missing databases/events file (or .zip, .gz archive) in assets, or target folder not writable

Ensure you have an sqlite database included if you are referencing it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM