【问题标题】:android:exported needs to be explicitly specifiedandroid:exported 需要明确指定
【发布时间】:2022-09-23 11:29:02
【问题描述】:

我检查了 manifest.xml 文件中的所有活动,所有活动都存在于 android:exported=\"true\" 但它一直显示此错误 **Manifest merge failed : android:exported 需要为元素显式指定 <activity #im.dino.dbinspector.activities.DbInspectorActivity>。当相应组件定义了 Intent 过滤器时,面向 Android 12 及更高版本的应用需要为 android:exported 指定显式值。有关详细信息,请参阅https://developer.android.com/guide/topics/manifest/activity-element#exported。 ** 我现在该怎么办?

我的清单文件是

<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"
    xmlns:tools=\"http://schemas.android.com/tools\"
    package=\"shubham.lists.happyplaces\">

    <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />
    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />
    <uses-permission android:name=\"android.permission.CAMERA\" />

    <application
        android:allowBackup=\"true\"
        android:dataExtractionRules=\"@xml/data_extraction_rules\"
        android:fullBackupContent=\"@xml/backup_rules\"
        android:icon=\"@mipmap/ic_launcher\"
        android:label=\"@string/app_name\"
        android:roundIcon=\"@mipmap/ic_launcher_round\"
        android:supportsRtl=\"true\"
        android:theme=\"@style/Theme.HappyPlaces\"
        tools:targetApi=\"31\">
        <activity
            android:name=\".activities.AddHappyPlaceActivity\"
            android:exported=\"true\"
            android:label=\"ADD HAPPY PLACE\"
            android:screenOrientation=\"fullSensor\"
            android:theme=\"@style/CustomNoActionBarTheme\"
            tools:node=\"merge\" />
        <activity
            android:name=\".activities.MainActivity\"
            android:exported=\"true\"
            tools:node=\"merge\">
            <intent-filter>
                <action android:name=\"android.intent.action.MAIN\" />
                <category android:name=\"android.intent.category.LAUNCHER\" />
            </intent-filter>
        </activity>
    </application>

</manifest>

梯度构建

plugins {
    id \'com.android.application\'
    id \'org.jetbrains.kotlin.android\'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId \"shubham.lists.happyplaces\"
        minSdk 22
        targetSdk 32
        versionCode 1
        versionName \"1.0\"

        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile(\'proguard-android-optimize.txt\'), \'proguard-rules.pro\'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = \'1.8\'
    }
    buildFeatures{
        viewBinding true
    }
}

dependencies {
    implementation \'de.hdodenhof:circleimageview:3.1.0\'
    implementation \'androidx.core:core-ktx:1.8.0\'
    implementation \'androidx.appcompat:appcompat:1.4.2\'
    implementation \'com.google.android.material:material:1.6.1\'
    implementation \'androidx.constraintlayout:constraintlayout:2.1.4\'
    implementation \'com.karumi:dexter:6.0.1\'
    debugImplementation \'im.dino:dbinspector:3.4.1@aar\'

    //androidTestImplementation \"androidx.fragment:fragment-testing:<version>\"
    //androidTestImplementation \'androidx.test.ext:junit\'
    //androidTestImplementation \"androidx.test.ext:junit:1.1.3\"
    //androidTestImplementation \"androidx.compose.ui:ui-test-junit4:1.1.1\"
    //implementation \'androidx.core:core-ktx:1.8.0\'
    //implementation \'androidx.appcompat:appcompat:1.4.2\'
    //implementation \'com.google.android.material:material:1.6.1\'
    //implementation \'androidx.constraintlayout:constraintlayout:2.1.4\'
    implementation \'com.google.android.material:material:1.6.1\'
    testImplementation \'junit:junit:4.13.2\'
    androidTestImplementation \'androidx.test.ext:junit:1.1.3\'
    androidTestImplementation \'androidx.test.espresso:espresso-core:3.4.0\'
}

等待早期响应

  • DbInspectorActivity 在您的项目中吗?.. 如果不是在某些库中

标签: android kotlin


【解决方案1】:

尝试升级im.dino:dbinspector。你在 3.4.1。最新的是 5.4.7。并且基于the library's manifest in GitHub,应该修复这个问题。

【讨论】:

    【解决方案2】:

    我现在对 Udemy 的同一门课程有同样的问题,无法修复,已经观看了所有视频和所有主题:

    'kotlin-android-extensions' Gradle 插件已弃用。请使用此迁移指南 (https://goo.gle/kotlin-android-extensions-deprecation) 开始使用视图绑定 (https://developer.android.com/topic/libraries/view-binding) 和“kotlin-parcelize”插件。

    【讨论】:

      猜你喜欢
      • 2022-07-13
      • 1970-01-01
      • 2023-01-03
      • 2023-02-12
      • 2022-01-17
      • 2022-09-29
      • 2021-11-28
      • 2022-08-12
      • 2021-10-03
      相关资源
      最近更新 更多