繁体   English   中英

为什么我的 Android main_activity 没有加载到我的设备上,但一切都适用于模拟器?

[英]Why is my Android main_activity not loading on my device but everything works with the emulator?

问题:我不知道如何在我的设备上确定为什么我的 Android 应用程序在安装后无法启动,但在模拟器中启动却没有问题? main_actiity不会启动(见下文),但我收到来自MainActivity的权限检查 window 。

此应用程序已成功安装和启动多次,几个月没有出现问题。 我所做的最后一次更新是对预填充数据库的数据库迁移更新和对TableLayout的表示更新。 我在调试期间没有收到任何错误,或者可以在 Logcat 中找到问题。 不过,我还在学习 Android。

我试过的:除了在这个论坛上阅读一些类似的问题。 至少对我来说,很难通过一个模拟器安装来发现手机上没有问题的问题。 不确定如何找到问题。 我已经查看了提供的 Logcat 详细结果,但对 Android 来说是新手,我没有任何反应。 所以我还提供了一个模拟器安装映像与手机安装映像。

更新:我现在不知道这是否应该是一个新问题。 该应用程序正在生成数据库架构错误。 此应用程序使用预先填充的数据库。 因此,当我卸载并重新安装更新的更改时,是否有可能保留旧数据库? 我的模拟器没有这个问题。

模拟器 Pixel 4 XL API 28 目标 Android 9 没有问题(main_activity 确实加载了)

模拟器

三星 A51 w/ Android 11 (main_activity 未加载)在单击“允许”后我收到“ResarchDB 不断停止”错误消息提供了单击“应用程序信息”或“关闭应用程序”的选项,但没有更具体的选项。

电话

来自手机的 Logcat (将应用程序启动安装到模拟器)已更新

2021-11-24 11:45:32.679 26024-26024/com.mistywillow.researchdb D/ActivityThread: handleBindApplication()++ app=com.mistywillow.researchdb
2021-11-24 11:45:32.686 26024-26024/com.mistywillow.researchdb D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
2021-11-24 11:45:32.587 26024-26024/? I/libc: SetHeapTaggingLevel: tag level set to 0
2021-11-24 11:45:32.598 26024-26024/? I/llow.researchd: Late-enabling -Xcheck:jni
2021-11-24 11:45:32.642 26024-26024/? I/llow.researchd: Unquickening 24 vdex files!
2021-11-24 11:45:32.661 26024-26024/? D/ActivityThread: setConscryptValidator
2021-11-24 11:45:32.661 26024-26024/? D/ActivityThread: setConscryptValidator - put
2021-11-24 11:45:32.587 26024-26024/? I/libc: SetHeapTaggingLevel: tag level set to 0
2021-11-24 11:45:32.598 26024-26024/? I/llow.researchd: Late-enabling -Xcheck:jni
2021-11-24 11:45:32.642 26024-26024/? I/llow.researchd: Unquickening 24 vdex files!
2021-11-24 11:45:32.661 26024-26024/? D/ActivityThread: setConscryptValidator
2021-11-24 11:45:32.661 26024-26024/? D/ActivityThread: setConscryptValidator - put
2021-11-24 11:45:32.746 26024-26024/com.mistywillow.researchdb D/LoadedApk: LoadedApk::makeApplication() appContext=android.app.ContextImpl@8236f59 appContext.mOpPackageName=com.mistywillow.researchdb appContext.mBasePackageName=com.mistywillow.researchdb appContext.mPackageInfo=android.app.LoadedApk@ad9b71e
2021-11-24 11:45:32.746 26024-26024/com.mistywillow.researchdb D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-11-24 11:45:32.764 26024-26024/com.mistywillow.researchdb D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-11-24 11:45:32.771 26024-26024/com.mistywillow.researchdb D/ActivityThread: handleBindApplication() -- skipGraphicsSupport=false
2021-11-24 11:45:32.781 26024-26350/com.mistywillow.researchdb D/libMEOW: meow reload base cfg path: na
2021-11-24 11:45:32.781 26024-26350/com.mistywillow.researchdb D/libMEOW: meow reload overlay cfg path: na
2021-11-24 11:45:32.781 26024-26350/com.mistywillow.researchdb D/libMEOW: applied 0 plugin for [com.mistywillow.researchdb].
2021-11-24 11:45:32.782 26024-26353/com.mistywillow.researchdb D/libMEOW: applied 0 plugin for [com.mistywillow.researchdb].
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb E/ion: ioctl c0044901 failed with code -1: Invalid argument
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb D/libjpeg-alpha-oal: SWIP_INIT
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb D/libjpeg-alpha-oal: MTXXXX_JPEG_SWIP_PROTECTION value=1
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb D/libjpeg-alpha-oal: Address(orig)     = 0x78a57c7258 0xedc
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb D/libjpeg-alpha-oal: Address(modified) = 0x78a57c637c
2021-11-24 11:45:32.859 26024-26024/com.mistywillow.researchdb D/libjpeg-alpha-oal: Intermidiate 78a57c8088, 4ff3
2021-11-24 11:45:32.861 26024-26024/com.mistywillow.researchdb I/DecorView: [INFO] isPopOver=false, config=true
2021-11-24 11:45:32.861 26024-26024/com.mistywillow.researchdb I/DecorView: updateCaptionType >> DecorView@6e4f1e8[], isFloating=false, isApplication=true, hasWindowDecorCaption=false, hasWindowControllerCallback=true
2021-11-24 11:45:32.861 26024-26024/com.mistywillow.researchdb D/DecorView: setCaptionType = 0, this = DecorView@6e4f1e8[]
2021-11-24 11:45:32.882 26024-26024/com.mistywillow.researchdb W/llow.researchd: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-11-24 11:45:32.883 26024-26024/com.mistywillow.researchdb W/llow.researchd: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-11-24 11:45:32.984 26024-26024/com.mistywillow.researchdb I/SQLiteOpenHelper: DB version upgrading from 2 to 3
2021-11-24 11:45:33.002 26024-26024/com.mistywillow.researchdb D/AndroidRuntime: Shutting down VM
2021-11-24 11:45:33.003 26024-26024/com.mistywillow.researchdb E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mistywillow.researchdb, PID: 26024
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mistywillow.researchdb/com.mistywillow.researchdb.MainActivity}: java.lang.IllegalStateException: Migration didn't properly handle: Author_By_Source(com.mistywillow.researchdb.database.entities.AuthorBySource).
     Expected:
    TableInfo{name='Author_By_Source', columns={AuthorID=Column{name='AuthorID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, SourceID=Column{name='SourceID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=2, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='Author', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[AuthorID], referenceColumnNames=[AuthorID]}, ForeignKey{referenceTable='Source', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[SourceID], referenceColumnNames=[SourceID]}], indices=[Index{name='index_Author_By_Source_AuthorID', unique=false, columns=[AuthorID]}, Index{name='index_Author_By_Source_SourceID', unique=false, columns=[SourceID]}]}
     Found:
    TableInfo{name='Author_By_Source', columns={AuthorID=Column{name='AuthorID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, SourceID=Column{name='SourceID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=2, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='Sources', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[SourceID], referenceColumnNames=[SourceID]}, ForeignKey{referenceTable='Authors', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[AuthorID], referenceColumnNames=[AuthorID]}], indices=[Index{name='index_Author_By_Source_SourceID', unique=false, columns=[SourceID]}, Index{name='index_Author_By_Source_AuthorID', unique=false, columns=[AuthorID]}]}
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3819)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3995)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2309)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8587)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     Caused by: java.lang.IllegalStateException: Migration didn't properly handle: Author_By_Source(com.mistywillow.researchdb.database.entities.AuthorBySource).
     Expected:
    TableInfo{name='Author_By_Source', columns={AuthorID=Column{name='AuthorID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, SourceID=Column{name='SourceID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=2, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='Author', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[AuthorID], referenceColumnNames=[AuthorID]}, ForeignKey{referenceTable='Source', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[SourceID], referenceColumnNames=[SourceID]}], indices=[Index{name='index_Author_By_Source_AuthorID', unique=false, columns=[AuthorID]}, Index{name='index_Author_By_Source_SourceID', unique=false, columns=[SourceID]}]}
     Found:
2021-11-24 11:45:33.004 26024-26024/com.mistywillow.researchdb E/AndroidRuntime: TableInfo{name='Author_By_Source', columns={AuthorID=Column{name='AuthorID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, SourceID=Column{name='SourceID', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=2, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='Sources', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[SourceID], referenceColumnNames=[SourceID]}, ForeignKey{referenceTable='Authors', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[AuthorID], referenceColumnNames=[AuthorID]}], indices=[Index{name='index_Author_By_Source_SourceID', unique=false, columns=[SourceID]}, Index{name='index_Author_By_Source_AuthorID', unique=false, columns=[AuthorID]}]}
        at androidx.room.RoomOpenHelper.onUpgrade(RoomOpenHelper.java:103)
        at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onUpgrade(FrameworkSQLiteOpenHelper.java:177)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:489)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
        at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:145)
        at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:106)
        at androidx.room.SQLiteCopyOpenHelper.getWritableDatabase(SQLiteCopyOpenHelper.java:97)
        at androidx.room.RoomDatabase.inTransaction(RoomDatabase.java:622)
        at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:399)
        at com.mistywillow.researchdb.database.TopicsDao_Impl.getTopics(TopicsDao_Impl.java:121)
        at com.mistywillow.researchdb.DBQueryTools.captureDBTopics(DBQueryTools.java:149)
        at com.mistywillow.researchdb.MainActivity.onCreate(MainActivity.java:74)
        at android.app.Activity.performCreate(Activity.java:8207)
        at android.app.Activity.performCreate(Activity.java:8191)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3792)
            ... 11 more
2021-11-24 11:45:36.129 26024-26024/com.mistywillow.researchdb I/Process: Sending signal. PID: 26024 SIG: 9

请添加Logcat - 在真机打开应用后报错

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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