Android Question App Force Closes on Launch

Hello,
I compile a source but it immediately force closes and no error is even printed! Even the first line of Activity_Create doesn't execute!
This is my manifest code:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
CreateResourceFromFile(Macro, Core.NetworkClearText)
SetApplicationAttribute(android:usesCleartextTraffic, "true")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="@style/Theme.AppCompat.Light">
        <item name="colorPrimary">#ffffff</item>
        <item name="colorPrimaryDark">#ffffff</item>
        <item name="colorAccent">#130D6F</item>
        <item name="android:navigationBarColor">#ffffff</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>     
        <item name="android:windowLightStatusBar">true</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="android:textColorLink">#4FA7CD</item>
    </style>
</resources>
)

SetApplicationAttribute(android:requestLegacyExternalStorage, true)
AddApplicationText(<meta-data
   android:name="com.google.android.gms.version"
   android:value="@integer/google_play_services_version" />
)

'************ Google Play Services Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
'************ Google Play Services Base (end) ************
'************ Firebase Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
'************ Firebase Base (end) ************
'************ Firebase Notifications ************
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
'************ Firebase Notifications (end)************
'************ Firebase Auth ************
CreateResourceFromFile(Macro, Core.NetworkClearText)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
'************ Firebase Auth (end) ************
AddPermission(android.permission.INTERNET) ' Allows applications to open network sockets.
AddPermission(android.permission.ACCESS_NETWORK_STATE) ' Allows applications to access information about networks.
SetApplicationAttribute(android:usesCleartextTraffic, "true")


AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.RECORD_AUDIO)
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.WRITE_CONTACTS")
AddPermission(android.permission.SEND_SMS)


'''''''''''''''Add This Line For Start EasyStartCropperEngine''''''''''''''''''''''''''''''''''''''''''''
AddApplicationText(<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity" android:theme="@style/Theme.AppCompats"/>)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'''''''''''''''''''''''''''''''Theme AppCompat'''''''''''''''''''''''''''
'SetApplicationAttribute(android:theme, "@style/Theme.AppCompats")
CreateResource(values, themeesajb.xml,
<resources>
    <style name="Theme.AppCompats" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">#FFFFFF</item>
        <item name="colorPrimaryDark">#FFFF</item>
        <item name="colorAccent">#5B5B72</item>
        <item name="windowNoTitle">false</item>
        <item name="windowActionBar">true</item>
        <item name="android:textColorPrimary">#5B5B72</item>
        <item name="android:windowLightStatusBar">true</item>
        <item name="android:windowDisablePreview">true</item>
    </style>
</resources>
)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

AddActivityText(LoginEmail,"<intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="https" android:host="MyDomain.com"/>
 
</intent-filter>")


'************ Required with GetSafeDirDefaultExternal ***********
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
'**************************************

'********************  Required for file provider *************************
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="shared" />
)
'***************************************************************
This is also the Project Attributes section:
B4X:
#Region  Project Attributes
    #ApplicationLabel: My App :)
    #VersionCode: 15
    #VersionName: 1.4.5
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
    #AdditionalJar: com.android.support:support-compat
    #Extends: android.support.v7.app.AppCompatActivity
        #AdditionalRes: ..\Resource
        #AdditionalRes: ..\resources
    #Extends :  androidx.appcompat.app.AppCompatActivity
    #AdditionalRes:../res
    #AdditionalRes:../res_icon
    #AdditionalJar : androidx.appcompat:appcompat
    #MultiDex : true
    #Extends: de.amberhome.materialdialogs.MaterialDialogsActivity
    #AdditionalRes:../res_icon2

    #BridgeLogger:true
#End Region
The project is successfully compiled and installed on the simulator, but it is force closed as soon as it is executed. What is the problem?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
I unchecked the filter checkbox and found this error:
B4X:
  Force finishing activity com.myapp.b4atest/.main
Killing 7435:com.myapp.b4atest/u0a241 (adj 900): crash
Successfully killed process cgroup uid 10241 pid 7435 in 0ms
Input channel object '7c9c1de Application Error: com.myapp.b4atest (client)' was disposed without first being removed with the input manager!
Process 7435 exited due to signal 9 (Killed)
Unknown focus tokens, dropping reportFocusChanged
Got obituary of 7435:com.myapp.b4atest
Attempted to finish an input event but the input event receiver has already been disposed.
GoogleInputMethodService.onFinishInput():3220
GoogleInputMethodService.updateDeviceLockedStatus():2114 repeatCheckTimes = 0, unlocked = true
GoogleInputMethodService.onStartInput():1919 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=com.google.android.apps.nexuslauncher fieldId=-1 fieldName=null extras=null}, false)
GoogleInputMethodService.updateDeviceLockedStatus():2114 repeatCheckTimes = 2, unlocked = true
tagSocket(80) with statsTag=0xffffffff, statsUid=-1
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
onUnbind: Intent { act=com.google.android.gms.scheduler.ACTION_PROXY_SCHEDULE dat=chimera-action:/... cmp=com.google.android.gms/.chimera.PersistentApiService }
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
failed to connect to socket 'tcp:6777': Connection refused
failed to connect to socket 'tcp:6778': Connection refused
tagSocket(78) with statsTag=0xffffffff, statsUid=-1
onUnbind: Intent { act=com.google.android.gms.feedback.internal.IFeedbackService dat=chimera-action:/... cmp=com.google.android.gms/.chimera.GmsBoundBrokerService }
onUnbind: Intent { act=com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE dat=chimera-action:/... cmp=com.google.android.gms/.chimera.PersistentApiService }
app_time_stats: avg=2272.97ms min=6.01ms max=20351.72ms count=9
[2] xrk.onStartJob(4): SCH: job service start with id 9553.
[225] xqb.a(78): SCH: Satisfied jobs for 9553 are: 12-1
[228] xqf.accept(72): SCH: Job 12-1 starting
[2] ContentSyncJob.v(3): [ContentSync] job started
[231] jdx.h(1): Completed 0 account content syncs with 0 successful.
[2] ContentSyncJob.a(1): [ContentSync] Installation state replication succeeded.
[2] xpx.r(4): SCH: jobFinished: 12-1. TimeElapsed: 70ms.
[64] xei.accept(45): SCH: Scheduling phonesky job Id: 1-1337, CT: 1716639183172, Constraints: [{ L: 25410039, D: 68610039, C: 1, I: 1, N: 1 }]
[64] xei.accept(45): SCH: Scheduling phonesky job Id: 28--559038737, CT: 1716639204810, Constraints: [{ L: 18000000, D: 82800000, C: 1, I: 1, N: 1 }]
[74] xeh.apply(50): SCH: Scheduling 1 system job(s)
[74] xpv.d(4): SCH: Scheduling system job Id: 9556, L: 17559296, D: 68147697, C: false, I: false, N: 1
[228] xrk.a(16): SCH: job service finished with id 9553.
motion timeout went off and device isn't stationary
app_time_stats: avg=17163.00ms min=17163.00ms max=17163.00ms count=1
tagSocket(80) with statsTag=0xffffffff, statsUid=-1
Scan result ready event
Scan result ready event
tagSocket(78) with statsTag=0xffffffff, statsUid=-1
app_time_stats: avg=23795.71ms min=23795.71ms max=23795.71ms count=1
Davey! duration=1157ms; Flags=0, FrameTimelineVsyncId=37695, IntendedVsync=742111194474, Vsync=742111194474, InputEventId=0, HandleInputStart=742112853400, AnimationStart=742112871400, PerformTraversalsStart=742112897500, DrawStart=742112942100, FrameDeadline=742127861140, FrameInterval=742112841900, FrameStartTime=16666666, SyncQueued=742113060800, SyncStart=742113127400, IssueDrawCommandsStart=742113203000, SwapBuffers=742113979000, FrameCompleted=743268586200, DequeueBufferDuration=45500, QueueBufferDuration=788200, GpuCompleted=743268586200, SwapBuffersCompleted=743134170100, DisplayPresentTime=0, CommandSubmissionCompleted=742113979000,
Slow dispatch took 287ms main h=com.android.server.job.JobSchedulerService$JobHandler c=null m=8
StartCommandInProcess(73657474696e67730067657400656e61 settings.get.ena [truncated])
type=1400 audit(0.0:110): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
type=1400 audit(0.0:111): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
type=1400 audit(0.0:112): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
StartCommandInProcess(7061636b61676500696e7374616c6c00 package.install. [truncated])
type=1400 audit(0.0:113): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
Integrity check passed for file:///data/app/vmdl1272715824.tmp
Force stopping com.myapp.b4atest appid=10241 user=-1: installPackageLI
Update package com.myapp.b4atest code path from /data/app/~~JQqznOLf8sA00yAP8cyLZw==/com.myapp.b4atest-gMZRsikSDDfM--WV3rJqNQ== to /data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==; Retain data and using new
interaction: PackageSetting{7827d97 com.example.myapplication/10169} -> PackageSetting{b873eef com.myapp.b4atest/10241} BLOCKED
interaction: PackageSetting{7827d97 com.example.myapplication/10169} -> PackageSetting{f7c6f6d com.myapp.b4atest/10241} BLOCKED
Skipping PackageSetting{1796598 b4a.example.changeicon/10197} due to missing metadata
Unable to open '/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/base.dm': No such file or directory
Running dexopt (dexoptNeeded=1) on: /data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/base.apk pkg=com.myapp.b4atest isa=x86_64 dexoptFlags=boot_complete,profile_guided,public,enable_hidden_api_checks targetFilter=speed-profile oatDir=/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/oat classLoaderContext=PCL[]{PCL[/system/framework/android.test.base.jar]}
DexInv: --- BEGIN '/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/base.apk' ---
Running /apex/com.android.art/bin/dex2oat64 in=base.apk out=/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/oat/x86_64/base.odex
Unexpected CPU variant for x86: x86_64.
Known variants: atom, sandybridge, silvermont, kabylake, default
Mismatch between dex2oat instruction set features to use (ISA: X86_64 Feature string: -ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) and those from CPP defines (ISA: X86_64 Feature string: ssse3,sse4.1,sse4.2,-avx,-avx2,popcnt) for the command line:
/apex/com.android.art/bin/dex2oat64 --zip-fd=7 --zip-location=base.apk --oat-fd=8 --oat-location=/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw==/oat/x86_64/base.odex --input-vdex-fd=-1 --output-vdex-fd=9 --swap-fd=10 --classpath-dir=/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw== --class-loader-context=PCL[]{PCL[/system/framework/android.test.base.jar]} --compact-dex-level=none --instruction-set=x86_64 --instruction-set-features=default --instruction-set-variant=x86_64 --compiler-filter=speed-profile --compilation-reason=install --max-image-block-size=524288 --resolve-startup-const-strings=true --generate-mini-debug-info --runtime-arg -Xtarget-sdk-version:29 --runtime-arg -Xhidden-api-policy:enabled --runtime-arg -Xms64m --runtime-arg -Xmx512m
/apex/com.android.art/bin/dex2oat64 --input-vdex-fd=-1 --output-vdex-fd=9 --classpath-dir=/data/app/~~MmQtbRuVb440Z7VpLY_efw==/com.myapp.b4atest-mxzrF0Tdbp9QXycsil9xIw== --class-loader-context=PCL[]{PCL[/system/framework/android.test.base.jar]} --compact-dex-level=none --compiler-filter=speed-profile --compilation-reason=install --max-image-block-size=524288 --resolve-startup-const-strings=true --generate-mini-debug-info
Using CollectorTypeCC GC.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the error:

Process: com.myapp.b4atest, PID: 6232
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at androidx.savedstate.SavedStateRegistryController$Companion.create(Unknown Source:2)
at androidx.savedstate.SavedStateRegistryController.create(Unknown Source:2)
at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:115)
at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
at androidx.appcompat.app.AppCompatActivity.<init>(AppCompatActivity.java:94)
at de.amberhome.materialdialogs.MaterialDialogsActivity.<init>(MaterialDialogsActivity.java:18)

1. I don't recommend using AppCompat. It was useful when Android 4 was popular. Not anymore.

2. Add to main module:
B4X:
#AdditionalJar: kotlin-stdlib-1.6.10
 
Upvote 0
This is the error:

Process: com.myapp.b4atest, PID: 6232
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at androidx.savedstate.SavedStateRegistryController$Companion.create(Unknown Source:2)
at androidx.savedstate.SavedStateRegistryController.create(Unknown Source:2)
at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:115)
at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
at androidx.appcompat.app.AppCompatActivity.<init>(AppCompatActivity.java:94)
at de.amberhome.materialdialogs.MaterialDialogsActivity.<init>(MaterialDialogsActivity.java:18)

1. I don't recommend using AppCompat. It was useful when Android 4 was popular. Not anymore.

2. Add to main module:
B4X:
#AdditionalJar: kotlin-stdlib-1.6.10
I appreciate your help and guidance. Thank you for your time ? ?
I had bought this source a few years ago, that's why appCompat was used, and due to the large size of the project, it is not possible to delete it.
The previous error was fixed and now this error occurs:
B4X:
Process: com.myapp.b4atest, PID: 5186
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/arch/core/executor/ArchTaskExecutor;
    at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:322)
    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:178)
    at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:230)
    at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
    at androidx.appcompat.app.AppCompatActivity.<init>(AppCompatActivity.java:94)
    at de.amberhome.materialdialogs.MaterialDialogsActivity.<init>(MaterialDialogsActivity.java:18)
    at com.myapp.b4atest.main.<init>(main.java:17)
    at java.lang.Class.newInstance(Native Method)
    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1339)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
    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:2307)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.ClassNotFoundException: androidx.arch.core.executor.ArchTaskExecutor
    ... 23 more
 
Upvote 0
Top