7

I have been searching SO and other android blogs from last 5-7 hours to get rid of one error but could not. In Android Studio, I imported an old project of eclipse but the error "Manifest merger failed' persists like

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:11.0.4] C:\Users\.android\build-cache\857c11d37cd8661c3d52cb060657f8bf3635bb7a\output\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage

when I checked mentioning minSdkVersion in build.gradle then I got Gradle build finished with 227 error(s) in 1m 30s 253ms some errors are:

    Z:\#1 ready\others\UVPlayermasterpart1\HoppingBird\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
    Z:\#1 ready\others\UVPlayermasterpart1\HoppingBird\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(280) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(106, 21) No resource found that matches the given name: attr 'android:colorAccent'.
.
.
.
.Error:(203, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
.
.

and using overrideLibrary in manifest file did not work.

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "bb.hoppingbird"
        //minSdkVersion 14
        //targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="bb.hoppingbird"
    android:versionCode="1"
    android:versionName="1.0">

    <supports-screens
        android:xlargeScreens="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="false" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name">

        <activity
            android:name="bb.hoppingbird.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Ads Using Google Play Services SDK -->
        <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version"/>

        <activity android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

</manifest>

I will appreciate your answers. Thank You

blueseal
  • 2,726
  • 6
  • 26
  • 41
  • possible duplicate of [this Qestion](https://stackoverflow.com/questions/35842955/manifest-merger-failed-with-multiple-errors-in-android-studio/42023614#42023614) – CLIFFORD P Y Oct 24 '17 at 20:12
  • Start by setting minSdkVersion to 9 and using an older version of Google Play Services, such as `8.+`. Make sure you have the Google Repo downloaded in the SDK Manager. /// `+` means "use the latest" and latest Google Play services is version 11.4.2 which needs support library 26.1.0 which in turn needs compile SDK version 26 and min SDK version 14. And that's too much for you right now. – Eugen Pechanec Oct 24 '17 at 20:19
  • Perhaps it would be easier to make a new project in Android Studio since you only have one activity. – Eugen Pechanec Oct 24 '17 at 20:19
  • @SudhirPradhan please post full error log if you can – Dima Kozhevin Oct 24 '17 at 20:29
  • @DimaKozhevin please see again I have updated some more errors that could help us find the issues..thank you. – blueseal Oct 24 '17 at 20:43
  • @EugenPechanec I got errors ** failed to resolve com.android.support:support-v4:26.1.0** when changed to target version 26 and support library 26.1.0.. thanks – blueseal Oct 24 '17 at 20:53
  • @SudhirPradhan Focus on one problem at a time. First make your original code compile (compileSdkVersion 19, minSdkVersion 9, targetSdkVersion 19, support library 19.1.0 and Google Play Services 8.+). Once you get that working, ask another question. – Eugen Pechanec Oct 24 '17 at 21:00
  • @CLIFFORDPY just took the help from 'merged manifest' ..but still error is persists – blueseal Oct 24 '17 at 21:06
  • @EugenPechanec followed your advice and changed to compilesdkversion 19,minsdkversion 9, support library 19.1.0 and play service 8.+ ....still didn't work – blueseal Oct 24 '17 at 21:15
  • I'm afraid It's not going to work out of the box. You will have to make some adjustments. But you have better chance if you match your original setup as close as you can. What errors do you see now? – Eugen Pechanec Oct 25 '17 at 08:13

3 Answers3

3

You should change from:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "bb.hoppingbird"
        //minSdkVersion 14
        //targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
}

to:

apply plugin: 'com.android.application'
repositories {
    maven { url 'https://maven.google.com' }
}
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "bb.hoppingbird"
        minSdkVersion 14
        targetSdkVersion 26
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.google.android.gms:play-services:11.4.2'
}

Update: Please follow these instructions:

Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
  • I already checked. but still this error persists.so I commented out those lines. thanks. – blueseal Oct 24 '17 at 19:58
  • @SudhirPradhan you cann't get this error `uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:11.0.4]` when you tried my answer. – Dima Kozhevin Oct 24 '17 at 20:06
  • true that..as I have already checked that..when I use minsdkversion I get a whole new bunch of errors – blueseal Oct 24 '17 at 20:10
  • @SudhirPradhan I left for you couple links as an update. I hope them help you. – Dima Kozhevin Oct 24 '17 at 20:15
  • I have updated questions with some errors ..please see ..and too I have checked using com.google.android.gms:play-services:11.4.2 but didn't work – blueseal Oct 24 '17 at 20:25
  • @DimKozhevin definitely I will check those links – blueseal Oct 24 '17 at 20:57
  • @DimKozhevin earlier I have not checked using repositories { maven { url 'https://maven.google.com' } } now I checked using it..and error gone ...but I encountered this (not error) **All com.android.support libraries must use the exact same version specification. found versions 26.1.0, 25.2.0. examples include com.android.support:support-compact:26.1.0 and com.android.support:android:animated-vector-drawable:25.2.0** could you help me on this then after I will accept your answer – blueseal Oct 25 '17 at 06:15
  • @SP You should ask another question but before see https://stackoverflow.com/q/42374151/3166697 – Dima Kozhevin Oct 25 '17 at 07:22
1

if you are using AppCompatActivity in your project then you need to change minSdkVersion 14 for com.android.support:appcompat-v7:26.1.0 inside build.gradel file

    minSdkVersion 14
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
rakesh rajput
  • 606
  • 4
  • 5
1

Anyone coming here from libGDX, in your game-project/android/build.gradle change your minSdkVersion from 14 to 16. For example:

defaultConfig {
// other config options...
    minSdkVersion 16
}
Joe Gasewicz
  • 1,252
  • 15
  • 20