Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

application crash #9

Open
odejinmi opened this issue Apr 11, 2022 · 1 comment
Open

application crash #9

odejinmi opened this issue Apr 11, 2022 · 1 comment

Comments

@odejinmi
Copy link

Unable to start service qiuxiang.android_window.WindowService@f5edd4b with Intent { cmp=com.konn3ct.konn3ct/qiuxiang.android_window.WindowService (has extras) }: java.lang.ClassCastException: android.app.Application cannot be cast to qiuxiang.android_window.AndroidWindowApplication
E/AndroidRuntime(27343): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4133)
E/AndroidRuntime(27343): at android.app.ActivityThread.access$1900(ActivityThread.java:226)
E/AndroidRuntime(27343): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916)
E/AndroidRuntime(27343): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(27343): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(27343): at android.app.ActivityThread.main(ActivityThread.java:7386)
E/AndroidRuntime(27343): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27343): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(27343): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
E/AndroidRuntime(27343): Caused by: java.lang.ClassCastException: android.app.Application cannot be cast to qiuxiang.android_window.AndroidWindowApplication
E/AndroidRuntime(27343): at qiuxiang.android_window.WindowService.onStartCommand(WindowService.kt:25)
E/AndroidRuntime(27343): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4115)
E/AndroidRuntime(27343): ... 8 more
I/Process (27343): Sending signal. PID: 27343 SIG: 9

@qiuxiang
Copy link
Owner

Did you follow these steps to setup your android project?

MainActivity.kt:

class MainActivity : qiuxiang.android_window.AndroidWindowActivity()

Create MainApplication.kt:

package your_package // same as MainActivity.kt
class MainApplication : qiuxiang.android_window.AndroidWindowApplication()

Add android:name=".MainApplication" to AndroidManifest.xml <application>:

<application
  android:name=".MainApplication"
  ...
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants