android studio编译安装apk失败

上午11:17 Failed to commit install session 1012874714 with command cmd package install-commit 1012874714. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1012874714.tmp/base.apk (at Binary XML file line #30): com.example.secondamsapp.MainActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present

上午11:17 Session ‘app’: Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
Retry

解决方案
添加export属性

        <activity android:name=".MainActivity"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>```

猜你喜欢

转载自blog.csdn.net/xiaoyantan/article/details/125570756