jing332 / SherpaOnnxTtsEngineAndroid

23 stars 3 forks source link

Crash while downloading all models #3

Open mablue opened 6 months ago

mablue commented 6 months ago

https://paste.crdroid.net/HnhPZo

time: 1709446801785
msg: java.lang.IllegalArgumentException: com.k2fsa.sherpa.onnx.tts.engine: Targeting U+ (version 34 and above) disallows creating or retrieving a PendingIntent with FLAG_MUTABLE, an implicit Intent within and without FLAG_NO_CREATE and FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for security reasons. To retrieve an already existing PendingIntent, use FLAG_NO_CREATE, however, to create a new PendingIntent with an implicit Intent use FLAG_IMMUTABLE.
stacktrace: java.lang.RuntimeException: Unable to start service com.k2fsa.sherpa.onnx.tts.engine.service.ModelManagerService@78618c6 with Intent { dat=https://github.com/... cmp=com.k2fsa.sherpa.onnx.tts.engine/.service.ModelManagerService (has extras) }: java.lang.IllegalArgumentException: com.k2fsa.sherpa.onnx.tts.engine: Targeting U+ (version 34 and above) disallows creating or retrieving a PendingIntent with FLAG_MUTABLE, an implicit Intent within and without FLAG_NO_CREATE and FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for security reasons. To retrieve an already existing PendingIntent, use FLAG_NO_CREATE, however, to create a new PendingIntent with an implicit Intent use FLAG_IMMUTABLE.
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4880)
    at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2314)
    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:8244)
    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:878)
Caused by: java.lang.IllegalArgumentException: com.k2fsa.sherpa.onnx.tts.engine: Targeting U+ (version 34 and above) disallows creating or retrieving a PendingIntent with FLAG_MUTABLE, an implicit Intent within and without FLAG_NO_CREATE and FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for security reasons. To retrieve an already existing PendingIntent, use FLAG_NO_CREATE, however, to create a new PendingIntent with an implicit Intent use FLAG_IMMUTABLE.
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3065)
    at android.os.Parcel.createException(Parcel.java:3045)
    at android.os.Parcel.readException(Parcel.java:3028)
    at android.os.Parcel.readException(Parcel.java:2970)
    at android.app.IActivityManager$Stub$Proxy.getIntentSenderWithFeature(IActivityManager.java:6632)
    at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:757)
    at android.app.PendingIntent.getBroadcast(PendingIntent.java:740)
    at u4.c.b(SourceFile:165)
    at com.k2fsa.sherpa.onnx.tts.engine.service.ModelManagerService.onStartCommand(Unknown Source:52)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4862)
    ... 9 more
mablue commented 6 months ago

The error message indicates an issue with how your app is trying to create a PendingIntent object on Android 14 (API level 34) and above. Here's a breakdown of the problem:

The problem:

Your app is trying to create a PendingIntent with an implicit intent and the FLAG_MUTABLE flag. This combination is no longer allowed on Android 14 (API level 34) for security reasons.

The solution:

There are two options depending on what you're trying to achieve:

  1. Retrieve an existing PendingIntent: If you already have a PendingIntent created earlier, use the FLAG_NO_CREATE flag when calling getBroadcast or getBroadcastAsUser methods on the PendingIntent object.

  2. Create a new PendingIntent: If you need to create a new PendingIntent with an implicit intent, use the FLAG_IMMUTABLE flag instead of FLAG_MUTABLE.

Additional tips: