Android 12 APK throws invalid package upon install

We Are Going To Discuss About Android 12 APK throws invalid package upon install. So lets Start this Android Article.

Android 12 APK throws invalid package upon install

How to solve Android 12 APK throws invalid package upon install

If you have bumped the compile version to 31, then you need to add
android:exported="true"
To your activities, services and receivers. See here.
In your case
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" /> <uses-permission android:name="android.permission.FLASHLIGHT" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:label="D MyApp" android:icon="@ref/0x7f07015e" android:name="crc646948444ac10504e5.MainApplication" android:debuggable="true" android:allowBackup="true" android:largeHeap="true" android:extractNativeLibs="true"> <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode" /> <activity android:theme="@ref/0x7f0d0001" android:label="MyApp" android:icon="@ref/0x7f07015e" android:name="crc646948444ac10504e5.MainActivity" android:screenOrientation="1" android:configChanges="0x680" android:exported="true"/> <activity android:theme="@ref/0x7f0d0000" android:name="crc646948444ac10504e5.SplashActivity" android:exported="true" android:screenOrientation="1" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="Web Authenticator" android:name="crc641e66d166111bdf3e.FormAuthenticatorActivity" android:exported="true"/> <activity android:label="Web Authenticator" android:name="crc641e66d166111bdf3e.WebAuthenticatorActivity" android:exported="true"/> <activity android:label="Web Authenticator Native Browser" android:name="crc641e66d166111bdf3e.WebAuthenticatorNativeBrowserActivity" android:launchMode="1" android:exported="true"/> <activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity" android:exported="true"/> <service android:name="crc64a98abb514ffad9f1.KeepAliveService" android:exported="true"/> <receiver android:label="Essentials Connectivity Broadcast Receiver" android:name="crc64a0e0a82d0db9a07d.ConnectivityBroadcastReceiver" android:enabled="true" android:exported="false" /> <receiver android:name="crc643f46942d9dd1fff9.PowerSaveModeBroadcastReceiver" android:enabled="true" android:exported="false" /> <provider android:name="mono.android.MultiDexLoader" android:exported="false" android:authorities="com.app.myapp.mono.android.MultiDexLoader.__mono_init__" android:initOrder="1999999999" /> <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:authorities="com.app.myapp.mono.MonoRuntimeProvider.__mono_init__" android:initOrder="1999999998" /> <activity android:theme="@ref/0x01030010" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false" /> <meta-data android:name="com.google.android.gms.version" android:value="@ref/0x7f090008" /> </application> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Please be wary of what really needs to be exported or not and change accordingly.
It could also be the case that App Center as of Android 11 requires a mandatory app signer, see here, here, and just in case, here is the snippet
As of Android 11, it’s mandatory to use the APK signer (if you use API level 30) as it will set some extra schemes “APK Signature Scheme v2 now required”. App Center now (since Dec 17, 2020) signs Android applications using APK signer internally, instead of JAR signer which was used previously. As part of the feature to enable APK signer in App Center, Android signing task V3 was implemented, and requirements for new Signing task were to change how keystore file is saved – to store the keystore file in an AzDO secure file (Android signing build and release task – Azure Pipelines | Microsoft Docs).
Warning
Any build configurations that had their keystore files uploaded prior to Dec 17, 2020 still use the APK Signature Scheme v2 signing method (jarsigner). To use the APK Signature Scheme v3 signing flow, users just have to re-upload their keystore files and save their branch configuration.

Android 12 APK throws invalid package upon install

If you have bumped the compile version to 31, then you need to add
android:exported="true"
To your activities, services and receivers. See here.
In your case
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" /> <uses-permission android:name="android.permission.FLASHLIGHT" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:label="D MyApp" android:icon="@ref/0x7f07015e" android:name="crc646948444ac10504e5.MainApplication" android:debuggable="true" android:allowBackup="true" android:largeHeap="true" android:extractNativeLibs="true"> <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode" /> <activity android:theme="@ref/0x7f0d0001" android:label="MyApp" android:icon="@ref/0x7f07015e" android:name="crc646948444ac10504e5.MainActivity" android:screenOrientation="1" android:configChanges="0x680" android:exported="true"/> <activity android:theme="@ref/0x7f0d0000" android:name="crc646948444ac10504e5.SplashActivity" android:exported="true" android:screenOrientation="1" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="Web Authenticator" android:name="crc641e66d166111bdf3e.FormAuthenticatorActivity" android:exported="true"/> <activity android:label="Web Authenticator" android:name="crc641e66d166111bdf3e.WebAuthenticatorActivity" android:exported="true"/> <activity android:label="Web Authenticator Native Browser" android:name="crc641e66d166111bdf3e.WebAuthenticatorNativeBrowserActivity" android:launchMode="1" android:exported="true"/> <activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity" android:exported="true"/> <service android:name="crc64a98abb514ffad9f1.KeepAliveService" android:exported="true"/> <receiver android:label="Essentials Connectivity Broadcast Receiver" android:name="crc64a0e0a82d0db9a07d.ConnectivityBroadcastReceiver" android:enabled="true" android:exported="false" /> <receiver android:name="crc643f46942d9dd1fff9.PowerSaveModeBroadcastReceiver" android:enabled="true" android:exported="false" /> <provider android:name="mono.android.MultiDexLoader" android:exported="false" android:authorities="com.app.myapp.mono.android.MultiDexLoader.__mono_init__" android:initOrder="1999999999" /> <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:authorities="com.app.myapp.mono.MonoRuntimeProvider.__mono_init__" android:initOrder="1999999998" /> <activity android:theme="@ref/0x01030010" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false" /> <meta-data android:name="com.google.android.gms.version" android:value="@ref/0x7f090008" /> </application> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Please be wary of what really needs to be exported or not and change accordingly.
It could also be the case that App Center as of Android 11 requires a mandatory app signer, see here, here, and just in case, here is the snippet
As of Android 11, it’s mandatory to use the APK signer (if you use API level 30) as it will set some extra schemes “APK Signature Scheme v2 now required”. App Center now (since Dec 17, 2020) signs Android applications using APK signer internally, instead of JAR signer which was used previously. As part of the feature to enable APK signer in App Center, Android signing task V3 was implemented, and requirements for new Signing task were to change how keystore file is saved – to store the keystore file in an AzDO secure file (Android signing build and release task – Azure Pipelines | Microsoft Docs).
Warning
Any build configurations that had their keystore files uploaded prior to Dec 17, 2020 still use the APK Signature Scheme v2 signing method (jarsigner). To use the APK Signature Scheme v3 signing flow, users just have to re-upload their keystore files and save their branch configuration.

Solution 1

If you have bumped the compile version to 31, then you need to add

android:exported="true"

To your activities, services and receivers. See here.

In your case

<uses-sdk
    android:minSdkVersion="21"
    android:targetSdkVersion="31" />

<uses-permission
    android:name="android.permission.FLASHLIGHT" />

<uses-permission
    android:name="android.permission.INTERNET" />

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

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

<application
    android:label="D MyApp"
    android:icon="@ref/0x7f07015e"
    android:name="crc646948444ac10504e5.MainApplication"
    android:debuggable="true"
    android:allowBackup="true"
    android:largeHeap="true"
    android:extractNativeLibs="true">

    <meta-data
        android:name="com.google.android.gms.vision.DEPENDENCIES"
        android:value="barcode" />

    <activity
        android:theme="@ref/0x7f0d0001"
        android:label="MyApp"
        android:icon="@ref/0x7f07015e"
        android:name="crc646948444ac10504e5.MainActivity"
        android:screenOrientation="1"
        android:configChanges="0x680"
        android:exported="true"/>

    <activity
        android:theme="@ref/0x7f0d0000"
        android:name="crc646948444ac10504e5.SplashActivity"
        android:exported="true"
        android:screenOrientation="1"
        android:noHistory="true">

        <intent-filter>

            <action
                android:name="android.intent.action.MAIN" />

            <category
                android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:label="Web Authenticator"
        android:name="crc641e66d166111bdf3e.FormAuthenticatorActivity" 
        android:exported="true"/>

    <activity
        android:label="Web Authenticator"
        android:name="crc641e66d166111bdf3e.WebAuthenticatorActivity" 
        android:exported="true"/>

    <activity
        android:label="Web Authenticator Native Browser"
        android:name="crc641e66d166111bdf3e.WebAuthenticatorNativeBrowserActivity"
        android:launchMode="1"
        android:exported="true"/>

    <activity
        android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity"
        android:exported="true"/>

    <service
        android:name="crc64a98abb514ffad9f1.KeepAliveService"
        android:exported="true"/>
    <receiver
        android:label="Essentials Connectivity Broadcast Receiver"
        android:name="crc64a0e0a82d0db9a07d.ConnectivityBroadcastReceiver"
        android:enabled="true"
        android:exported="false" />

    <receiver
        android:name="crc643f46942d9dd1fff9.PowerSaveModeBroadcastReceiver"
        android:enabled="true"
        android:exported="false" />

    <provider
        android:name="mono.android.MultiDexLoader"
        android:exported="false"
        android:authorities="com.app.myapp.mono.android.MultiDexLoader.__mono_init__"
        android:initOrder="1999999999" />

    <provider
        android:name="mono.MonoRuntimeProvider"
        android:exported="false"
        android:authorities="com.app.myapp.mono.MonoRuntimeProvider.__mono_init__"
        android:initOrder="1999999998" />

    <activity
        android:theme="@ref/0x01030010"
        android:name="com.google.android.gms.common.api.GoogleApiActivity"
        android:exported="false" />

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@ref/0x7f090008" />
</application>

<uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE" />

Please be wary of what really needs to be exported or not and change accordingly.

It could also be the case that App Center as of Android 11 requires a mandatory app signer, see here, here, and just in case, here is the snippet

As of Android 11, it’s mandatory to use the APK signer (if you use API level 30) as it will set some extra schemes “APK Signature Scheme v2 now required”. App Center now (since Dec 17, 2020) signs Android applications using APK signer internally, instead of JAR signer which was used previously. As part of the feature to enable APK signer in App Center, Android signing task V3 was implemented, and requirements for new Signing task were to change how keystore file is saved – to store the keystore file in an AzDO secure file (Android signing build and release task – Azure Pipelines | Microsoft Docs).

Warning
Any build configurations that had their keystore files uploaded prior to Dec 17, 2020 still use the APK Signature Scheme v2 signing method (jarsigner). To use the APK Signature Scheme v3 signing flow, users just have to re-upload their keystore files and save their branch configuration.

Original Author LethalMaus Of This Content

Solution 2

It may be that it doesn’t like the install location “auto”, resulting in:

android:installLocation="0"

Which should be one of:

android:installLocation=["auto" | "internalOnly" | "preferExternal"]

Original Author Martin Zeitler Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment