E/AndroidRuntime(15886): java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.IllegalArgumentException: br.com.cspautomacao.lazarus_comanda: 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.
这个错误在我更新到Android SDK 34后开始发生。
我的依赖项:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Dependências comuns
implementation fileTree(dir: "libs/comun", include: ['*.aar'])
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
// Dependências "elgin"
implementation fileTree(dir: 'libs/elgin', include: ['*.aar'])
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'com.google.code.gson:gson:2.8.6'
}
字符串
1条答案
按热度按时间ktca8awb1#
该错误表示,从Android 14(API 34)开始,如果您在带FLAG_MUTABLE的PendingIntent对象中有隐式Intent,则您的应用将崩溃。
如果您不需要FLAG_MUTABLE标志,那么只需将其更改为FLAG_IMMUTABLE即可。但是,如果您的应用需要可变Intent,那么我建议您使用以下解决方案之一:
1-使用FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
字符串
2-将隐式意图更改为显式意图
通过提供目标应用程序的包名称或完全限定的组件类名,明确您的意图。
型
参考资料: