I want to write a simple Android launcher, what opens the RealDash application when the phone is booted. I didn't want any grapichal interface, only launch the application immediately. After I wrote the code and selected my launcher for default launcher the phone is continously rebooting, but the RealDash app isn't start.
My code:
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
tools:targetApi="31">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name=".BootReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
MainActivity.kt
package com.example.customlauncher
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Launch RealDash app
val launchIntent = packageManager.getLaunchIntentForPackage("com.napko.RealDash")
if (launchIntent != null) {
startActivity(launchIntent)
}
finish() // finish the launcher activity
}
}
Logcat:
---------------------------- PROCESS STARTED (22037) for package com.example.customlauncher ----------------------------
2024-02-25 22:34:59.522 22037-22037 .customlauncher com.example.customlauncher W Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.
2024-02-25 22:34:59.522 22037-22037 .customlauncher com.example.customlauncher W Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.
2024-02-25 22:34:59.525 22037-22037 Compatibil...geReporter com.example.customlauncher D Compat change id reported: 171979766; UID 10197; state: ENABLED
2024-02-25 22:34:59.525 22037-22037 Compatibil...geReporter com.example.customlauncher D Compat change id reported: 242716250; UID 10197; state: ENABLED
2024-02-25 22:34:59.566 22037-22037 ziparchive com.example.customlauncher W Unable to open '/data/data/com.example.customlauncher/code_cache/.overlay/base.apk/classes3.dm': No such file or directory
2024-02-25 22:34:59.566 22037-22037 ziparchive com.example.customlauncher W Unable to open '/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/base.dm': No such file or directory
2024-02-25 22:34:59.566 22037-22037 ziparchive com.example.customlauncher W Unable to open '/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/base.dm': No such file or directory
2024-02-25 22:34:59.615 22037-22037 nativeloader com.example.customlauncher D Configuring clns-6 for other apk /data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.example.customlauncher
2024-02-25 22:34:59.651 22037-22037 GraphicsEnvironment com.example.customlauncher V Currently set values for:
2024-02-25 22:34:59.651 22037-22037 GraphicsEnvironment com.example.customlauncher V angle_gl_driver_selection_pkgs=[]
2024-02-25 22:34:59.655 22037-22037 GraphicsEnvironment com.example.customlauncher V angle_gl_driver_selection_values=[]
2024-02-25 22:34:59.668 22037-22037 GraphicsEnvironment com.example.customlauncher V ANGLE GameManagerService for com.example.customlauncher: false
2024-02-25 22:34:59.668 22037-22037 GraphicsEnvironment com.example.customlauncher V com.example.customlauncher is not listed in per-application setting
2024-02-25 22:34:59.668 22037-22037 GraphicsEnvironment com.example.customlauncher V Neither updatable production driver nor prerelease driver is supported.
2024-02-25 22:34:59.883 22037-22312 libEGL com.example.customlauncher D loaded /vendor/lib64/egl/libEGL_emulation.so
2024-02-25 22:34:59.908 22037-22312 libEGL com.example.customlauncher D loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
2024-02-25 22:34:59.909 22037-22312 libEGL com.example.customlauncher D loaded /vendor/lib64/egl/libGLESv2_emulation.so
2024-02-25 22:35:02.335 22037-22037 AndroidRuntime com.example.customlauncher D Shutting down VM
2024-02-25 22:35:02.350 22037-22037 AndroidRuntime com.example.customlauncher E FATAL EXCEPTION: main
Process: com.example.customlauncher, PID: 22037
java.lang.RuntimeException: Unable to instantiate receiver com.example.customlauncher.BootReceiver: java.lang.ClassNotFoundException: Didn't find class "com.example.customlauncher.BootReceiver" on path: DexPathList[[dex file "/data/data/com.example.customlauncher/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/base.apk"],nativeLibraryDirectories=[/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4435)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2256)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.customlauncher.BootReceiver" on path: DexPathList[[dex file "/data/data/com.example.customlauncher/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/base.apk"],nativeLibraryDirectories=[/data/app/~~mrf1UK2bf5ChJHWL4Pfr7Q==/com.example.customlauncher-4HwPQ03pDZ8cgYftNU_W6g==/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:110)
at androidx.core.app.CoreComponentFactory.instantiateReceiver(CoreComponentFactory.java:59)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4428)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2256)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
2024-02-25 22:35:02.495 22037-22037 Process com.example.customlauncher I Sending signal. PID: 22037 SIG: 9
---------------------------- PROCESS ENDED (22037) for package com.example.customlauncher ----------------------------
Shall I give the full path of the application to launch it, or I missed something?