I have an Azure build pipeline which is producing an APK which installs (via AppCenter) just fine on Android 10 but pops up the error:
App not installed as package appears to be invalid
on Android 12.
The AndroidManifest.xml
in the solution looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app.myapplocal" android:installLocation="auto" android:versionCode="1" android:versionName="1.1">
<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" />
<application android:label="L MyApp" android:icon="@drawable/icon" android:largeHeap="true"></application>
</manifest>
When I examine the manifest via Android Studio's APK Analyze
option, I see this:
<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" />
<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" />
<activity
android:label="Web Authenticator"
android:name="crc641e66d166111bdf3e.WebAuthenticatorActivity" />
<activity
android:label="Web Authenticator Native Browser"
android:name="crc641e66d166111bdf3e.WebAuthenticatorNativeBrowserActivity"
android:launchMode="1" />
<activity
android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity" />
<service
android:name="crc64a98abb514ffad9f1.KeepAliveService" />
<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" />
I had previously thought that the problem with Android 12 was that the android:targetSdkVersion
was set to 29
but changing this in the solution's manifest and changing the project file's TargetFrameworkVersion
from v11.0
to v12.0
did not help either. (This was updated in Visual Studio using the project properties' Application > Compile using Android version
value.)
What might I be missing in order to allow installing on recent Android devices? (I am not familiar with Xamarin or Android, I'm afraid.)
package appears to be invalid
isn't helpful at all – Damnify