清单合并失败:需要为 <receiver> 明确指定 android:exported
Manifest merger failed : android:exported needs to be explicitly specified for <receiver>
Merging Errors: Error: android:exported needs to be explicitly specified for element
<receiver#com.instacart.library.truetime.BootCompletedBroadcastReceiver>.
Apps targeting Android 12 and higher are required to specify an
explicit value for android:exported
when the corresponding component
has an intent filter defined. See
https://developer.android.com/guide/topics/manifest/activity-element#exported
for details. test.app main manifest (this file), line 19
我什至不知道该怎么办。我为这个错误挣扎了整整一个星期,但我做不到。
这是我的sdk版本
compileSdkVersion 32
defaultConfig {
multiDexEnabled true
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 32
versionCode 53
versionName "2.0.4"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
在所有 intent-filter
、service
和 provider
上写了 android:exported
。啊,我没有这个错误中提到的receiver
。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "com.android.billingclient:billing:4.0.0"
implementation "com.google.firebase:firebase-messaging:23.0.0"
implementation "com.google.firebase:firebase-crashlytics:18.2.7"
implementation "com.google.firebase:firebase-analytics:20.0.2"
implementation "com.google.firebase:firebase-perf:20.0.4"
implementation "com.google.firebase:firebase-dynamic-links:21.0.0"
implementation 'com.google.firebase:firebase-core:20.0.2'
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-config:21.0.1'
implementation "com.facebook.android:facebook-login:9.0.0"
implementation "com.facebook.android:facebook-share:[5,6)"
implementation "com.linecorp:linesdk:5.0.1"
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
implementation "com.squareup.retrofit2:retrofit:2.8.1"
implementation "com.squareup.retrofit2:converter-gson:2.8.1"
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.sun.easysnackbar:easysnackbar:1.0.1'
implementation 'com.romandanylyk:pageindicatorview:1.0.3@aar'
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
//MULTI DEX
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.android:flexbox:2.0.1'
implementation 'com.github.florent37:diagonallayout:1.0.9'
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
implementation 'com.github.instacart.truetime-android:library:3.4'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.4'
implementation "androidx.navigation:navigation-fragment-ktx:2.4.0"
implementation "androidx.navigation:navigation-ui-ktx:2.4.0"
implementation "com.github.bumptech.glide:glide:4.12.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
implementation "de.hdodenhof:circleimageview:3.1.0"
implementation "com.pixplicity.easyprefs:library:1.9.0"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation "com.airbnb.android:lottie:3.4.0"
implementation 'com.github.jinatonic.confetti:confetti:1.1.2'
implementation "com.nabinbhandari.android:permissions:3.8"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.github.YarikSOffice:lingver:1.2.1"
implementation 'com.github.mreram:showcaseview:1.2.0'
implementation 'com.github.shripal17:MaterialIntroView-v2:2.2.0'
implementation 'com.github.unsplash:unsplash-photopicker-android:1.0.0'
implementation 'com.giphy.sdk:ui:2.1.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.test.ext:junit:1.1.3"
}
com.instacart.library.truetime.BootCompletedBroadcastReceiver
在清单文件中检查这个....
检查你导入的库是否与你的 android 版本兼容
重建您的项目。
分享你的清单和
compileSdkVersion 32
defaultConfig {
multiDexEnabled true
applicationId "com.example.app" /// change your app Id not to use example... This will be rejected on play store
minSdkVersion 21
targetSdkVersion 32
versionCode 53
versionName "2.0.4"
//comment out this ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
发现 instacart.truetime
库存在问题。您正在使用 3.4
版本,他们在 3.5
中解决了此错误,如下所述:https://github.com/instacart/truetime-android/releases/tag/3.5
所以需要更新这些依赖到新版本3.5
implementation 'com.github.instacart.truetime-android:library:3.5'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.5'
构建应用并解决问题
Merging Errors: Error: android:exported needs to be explicitly specified for element <receiver#com.instacart.library.truetime.BootCompletedBroadcastReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for
android:exported
when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. test.app main manifest (this file), line 19
我什至不知道该怎么办。我为这个错误挣扎了整整一个星期,但我做不到。
这是我的sdk版本
compileSdkVersion 32
defaultConfig {
multiDexEnabled true
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 32
versionCode 53
versionName "2.0.4"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
在所有 intent-filter
、service
和 provider
上写了 android:exported
。啊,我没有这个错误中提到的receiver
。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "com.android.billingclient:billing:4.0.0"
implementation "com.google.firebase:firebase-messaging:23.0.0"
implementation "com.google.firebase:firebase-crashlytics:18.2.7"
implementation "com.google.firebase:firebase-analytics:20.0.2"
implementation "com.google.firebase:firebase-perf:20.0.4"
implementation "com.google.firebase:firebase-dynamic-links:21.0.0"
implementation 'com.google.firebase:firebase-core:20.0.2'
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-config:21.0.1'
implementation "com.facebook.android:facebook-login:9.0.0"
implementation "com.facebook.android:facebook-share:[5,6)"
implementation "com.linecorp:linesdk:5.0.1"
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
implementation "com.squareup.retrofit2:retrofit:2.8.1"
implementation "com.squareup.retrofit2:converter-gson:2.8.1"
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.sun.easysnackbar:easysnackbar:1.0.1'
implementation 'com.romandanylyk:pageindicatorview:1.0.3@aar'
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
//MULTI DEX
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.android:flexbox:2.0.1'
implementation 'com.github.florent37:diagonallayout:1.0.9'
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
implementation 'com.github.instacart.truetime-android:library:3.4'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.4'
implementation "androidx.navigation:navigation-fragment-ktx:2.4.0"
implementation "androidx.navigation:navigation-ui-ktx:2.4.0"
implementation "com.github.bumptech.glide:glide:4.12.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
implementation "de.hdodenhof:circleimageview:3.1.0"
implementation "com.pixplicity.easyprefs:library:1.9.0"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation "com.airbnb.android:lottie:3.4.0"
implementation 'com.github.jinatonic.confetti:confetti:1.1.2'
implementation "com.nabinbhandari.android:permissions:3.8"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.github.YarikSOffice:lingver:1.2.1"
implementation 'com.github.mreram:showcaseview:1.2.0'
implementation 'com.github.shripal17:MaterialIntroView-v2:2.2.0'
implementation 'com.github.unsplash:unsplash-photopicker-android:1.0.0'
implementation 'com.giphy.sdk:ui:2.1.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.test.ext:junit:1.1.3"
}
com.instacart.library.truetime.BootCompletedBroadcastReceiver
在清单文件中检查这个....
检查你导入的库是否与你的 android 版本兼容
重建您的项目。
分享你的清单和
compileSdkVersion 32
defaultConfig {
multiDexEnabled true
applicationId "com.example.app" /// change your app Id not to use example... This will be rejected on play store
minSdkVersion 21
targetSdkVersion 32
versionCode 53
versionName "2.0.4"
//comment out this ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
发现 instacart.truetime
库存在问题。您正在使用 3.4
版本,他们在 3.5
中解决了此错误,如下所述:https://github.com/instacart/truetime-android/releases/tag/3.5
所以需要更新这些依赖到新版本3.5
implementation 'com.github.instacart.truetime-android:library:3.5'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.5'
构建应用并解决问题