walexy
walexy

Reputation: 667

Manifest merger failed in android studio for a ionic capacitor app

I am trying to run my ionic-capacitor app with ionic capacitor run android --open. When i clicked on the play button in android studio to run the app, i got an error saying:

Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [androidx.security:security-crypto:1.0.0] /home/walexy/.gradle/caches/transforms-3/725ee2a45aaa5c74722288c88abd420b/transformed/jetified-security-crypto-1.0.0/AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 23, or use tools:overrideLibrary="androidx.security" to force usage (may lead to runtime failures)

How Can i solve this error?

Edit: This is the AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jeep.app.ionic.angular">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="com.jeep.app.ionic.angular.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask">

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

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <!-- Permissions -->

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

Upvotes: 0

Views: 1329

Answers (1)

MoonLight
MoonLight

Reputation: 557

The answer is in the error

uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library

or increase this project's minSdk version to at least 23

You are getting this error because you are using a library that isn't compatible with your current min sdk API, which can lead to run time errors if you execute it.

To fix this,

Open your gradle app (not gradle project they both are different) file and change the minSdkVersion to 23. Gradle File can be found under gradle scripts directory

Location of Gradle App File

In the file change the minSdkVersion to 23 or more based on your requirement.

Here is Min Sdk Tag

Upvotes: 3

Related Questions