升级到android、targetsdkversion 31以上时,出现以下错误和应用无法安装的问题

示例)
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/XXXXXXXX.tmp/base.apk (at Binary XML file line #445): io.gamepot.common.GamePotFCMIDService: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

需要在AndroidManifest.xml内定义android:exported。 需要添加下列语句。/(下列外部使用activty / service / receiver的部分应当按照相关用途进行定义。)

示例)

       <service
            android:exported="false"
            android:name="io.gamepot.common.GamePotFCMIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>
        <service
            android:exported="false"
            android:name="io.gamepot.common.GamePotFCMService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
        
        <!-- 若不使用ELSA服务,则删除下方语句/构建时不得包含gamepot-logger.aar [start]-->
        <receiver
            android:exported="false"
            android:name="com.navercorp.nelo2.android.util.NetworkStatusReceiver">
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
            </intent-filter>
        </receiver>
        <!-- 若不使用ELSA服务,则删除下方语句/构建时不得包含gamepot-logger.aar [end]-->
        
        
        <!-- 若不使用NAVER登录,则删除下方语句 [start]-->
        <activity android:exported="true" android:configChanges="orientation|screenSize" android:launchMode="singleTask" android:name="com.nhn.android.naverlogin.ui.OAuthCustomTabActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:host="authorize" android:path="/" android:scheme="naver3rdpartylogin"/>
            </intent-filter>
        </activity>
        <!-- 若不使用NAVER登录,则删除下方语句 [end]-->

Last updated