Мое приложение падает после инициализации INTENT - почему? - PullRequest
0 голосов
/ 27 февраля 2020

Как только я добавляю Intent i = new Intent(this, nextActivity.class); к своему коду, мое приложение больше не открывается и мгновенно падает. Я попытался отладить его на эмуляторе и на моем телефоне. Logcat:

02-27 12:03:51.124 1637-1646/com.android.systemui I/art: Debugger is no longer active
02-27 12:03:51.124 1667-1675/android.process.media I/art: Debugger is no longer active
02-27 12:03:51.124 2302-2309/com.android.providers.calendar I/art: Debugger is no longer active
02-27 12:03:51.126 1945-1957/com.google.android.gms.persistent I/art: Debugger is no longer active
02-27 12:03:51.145 2339-2339/com.android.deskclock V/AlarmClock: AlarmInitReceiver android.intent.action.TIME_SET
02-27 12:03:51.173 2500-2508/com.android.settings I/art: Debugger is no longer active
02-27 12:03:51.173 1637-1646/com.android.systemui W/art: Suspending all threads took: 49.014ms
02-27 12:03:51.220 2150-3150/com.google.android.gms I/SystemUpdate: [Installation,ReceiverIntentOperation] Received intent: Intent { act=android.intent.action.TIME_SET flg=0x24000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver }.
02-27 12:03:51.237 2150-3150/com.google.android.gms W/ChimeraUtils: Non Chimera context
02-27 12:03:51.237 2150-3150/com.google.android.gms W/ChimeraUtils: Non Chimera context
02-27 12:03:51.303 2150-3151/com.google.android.gms I/SystemUpdate: [Execution,InstallationEventIntentOperation] Handling event of type 6.
02-27 12:03:51.398 2150-3150/com.google.android.gms I/SystemUpdate: [Execution,InstallationIntentOperation] Received intent: Intent { act=com.google.android.gms.update.INSTALL_UPDATE cat=[targeted_intent_op_prefix:.update.execution.InstallationIntentOperation] cmp=com.google.android.gms/.chimera.GmsIntentOperationService }.
02-27 12:03:51.399 2150-3150/com.google.android.gms I/SystemUpdate: [Execution,ExecutionManager] Action finished-execution executed for 0.00 seconds.
02-27 12:03:51.448 2339-2361/com.android.deskclock V/AlarmClock: AlarmInitReceiver finished
02-27 12:03:54.296 3165-3165/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-27 12:03:54.297 3165-3165/? D/AndroidRuntime: CheckJNI is ON
02-27 12:03:54.335 3165-3165/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-27 12:03:54.335 3165-3165/? E/android.os.Debug: failed to load memtrack module: -2
02-27 12:03:54.353 3165-3165/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
02-27 12:03:54.369 3165-3165/? I/art: System.exit called, status: 0
02-27 12:03:54.369 3165-3165/? I/AndroidRuntime: VM exiting with result code 0.
02-27 12:03:54.472 3175-3175/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-27 12:03:54.473 3175-3175/? D/AndroidRuntime: CheckJNI is ON
02-27 12:03:54.513 3175-3175/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-27 12:03:54.513 3175-3175/? E/android.os.Debug: failed to load memtrack module: -2
02-27 12:03:54.530 3175-3175/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
02-27 12:03:54.551 1139-1139/? I/installd: free_cache(1423720) avail 285745152
02-27 12:03:54.592 3175-3175/? I/art: System.exit called, status: 0
02-27 12:03:54.592 3175-3175/? I/AndroidRuntime: VM exiting with result code 0.
02-27 12:03:54.682 3187-3187/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-27 12:03:54.683 3187-3187/? D/AndroidRuntime: CheckJNI is ON
02-27 12:03:54.716 3187-3187/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-27 12:03:54.716 3187-3187/? E/android.os.Debug: failed to load memtrack module: -2
02-27 12:03:54.735 3187-3187/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
02-27 12:03:54.758 1527-1565/system_process E/PackageInstaller: Commit of session 912649873 failed: Package /data/app/vmdl912649873.tmp/0_app-debug has no certificates at entry AndroidManifest.xml
02-27 12:03:54.760 3187-3187/? E/Pm: Failure details: Bundle[{android.content.pm.extra.STATUS=4, android.content.pm.extra.SESSION_ID=912649873, android.content.pm.extra.LEGACY_STATUS=-103, android.content.pm.extra.STATUS_MESSAGE=INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl912649873.tmp/0_app-debug has no certificates at entry AndroidManifest.xml}]
02-27 12:03:54.762 3187-3187/? I/art: System.exit called, status: 1
02-27 12:03:54.762 3187-3187/? I/AndroidRuntime: VM exiting with result code 1.
02-27 12:04:00.431 1527-1802/system_process D/AlarmManagerService: Kernel timezone updated to -60 minutes west of GMT
02-27 12:04:00.433 1527-1855/system_process D/AlarmManagerService: Setting time of day to sec=1582801441
02-27 12:04:01.020 2339-2339/com.android.deskclock V/AlarmClock: AlarmInitReceiver android.intent.action.TIME_SET
02-27 12:04:01.091 2339-2361/com.android.deskclock V/AlarmClock: AlarmInitReceiver finished
02-27 12:04:01.158 2150-3204/com.google.android.gms I/SystemUpdate: [Installation,ReceiverIntentOperation] Received intent: Intent { act=android.intent.action.TIME_SET flg=0x24000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver }.
02-27 12:04:01.218 2150-3203/com.google.android.gms I/SystemUpdate: [Execution,InstallationEventIntentOperation] Handling event of type 6.
02-27 12:04:01.220 2150-3205/com.google.android.gms I/SystemUpdate: [Execution,InstallationIntentOperation] Received intent: Intent { act=com.google.android.gms.update.INSTALL_UPDATE cat=[targeted_intent_op_prefix:.update.execution.InstallationIntentOperation] cmp=com.google.android.gms/.chimera.GmsIntentOperationService }.
02-27 12:04:01.316 2150-3205/com.google.android.gms I/SystemUpdate: [Execution,ExecutionManager] Action finished-execution executed for 0.00 seconds.

В inte rnet не было решения, которое помогло бы мне решить эту проблему. Это происходит сбой только при использовании Intent с этим кодом. Использование Intent любым другим способом не делает приложение cra sh.

Ответы [ 2 ]

0 голосов
/ 27 февраля 2020
Intent i = new Intent(this, nextActivity.class);

измените это на

Intent i = new Intent(MainActivity.this, NextActivity.class);

Также не забудьте добавить свои действия в Манифест. Эти оба класса расширяют AppCompatActivity или et c? *

0 голосов
/ 27 февраля 2020

К сожалению, в вашем вопросе не так много информации, которая могла бы помочь найти ошибку. Вы объявили активность ("NextActivity") в своем AndroidManifest. xml?

<activity
   android:name=".NextActivity"/>
...