簡體   English   中英

android:exported需要明確指定

[英]android:exported needs to be explicitly specified

我檢查了 manifest.xml 文件中的所有活動,所有活動都存在於 android:exported="true" 但它無條件地顯示此錯誤.dino.dbinspector.activities.DbInspectorActivity>。 當相應組件定義了意圖過濾器時,需要針對 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>

gradle 構建

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'
}

等待早期反應

嘗試升級im.dino:dbinspector 你在 3.4.1。 最新的是 5.4.7。 並且根據GitHub 中庫的清單,應該修復此問題。

我現在對 Udemy 的同一門課程有同樣的問題,無法修復,已經觀看了所有視頻和所有主題:

'kotlin-android-extensions' Gradle 插件已棄用。 Please use this migration guide ( https://goo.gle/kotlin-android-extensions-deprecation ) to start working with View Binding ( https://developer.android.com/topic/libraries/view-binding ) and the ' kotlin-parcelize 插件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM