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

Android 14下崩溃 #363

Open
joydance opened this issue May 1, 2024 · 2 comments
Open

Android 14下崩溃 #363

joydance opened this issue May 1, 2024 · 2 comments

Comments

@joydance
Copy link

joydance commented May 1, 2024

java.lang.RuntimeException: Unable to start service com.allenliu.versionchecklib.v2.ui.VersionService@451f213 with Intent { cmp=com.hdaniee.hdaniee.android/com.allenliu.versionchecklib.v2.ui.VersionService }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{9219a09 3466:com.hdaniee.hdaniee.android/u0a340} targetSDK=34

Android 14下有新的权限要求:
https://developer.android.com/about/versions/14/changes/fgs-types-required#permission-for-fgs-type

@crazycodepeng
Copy link

遇到了同样的问题
java.lang.RuntimeException: Unable to start service com.allenliu.versionchecklib.v2.ui.VersionService@b664748 with Intent{ cmp=包名/com.allenliu.versionchecklib.v2.ui.VersionService }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{e5b2746 1183:包名/u0a190} targetSDK=34

@felix996x
Copy link

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<!-- 针对不同类型的前台服务需要声明的权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />


  <service
        android:name="com.allenliu.versionchecklib.v2.ui.VersionService"
        android:exported="true"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:foregroundServiceType="dataSync"
        tools:replace="android:exported"
        android:priority="1000"
        tools:ignore="ForegroundServicePermission" />
        
        权限你们看着加,service必须写入,这样子才能覆盖它的

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

3 participants