Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appcompat v7 isn't pulled into project

I inherited a project which uses appcompat-v7:20.0.0
I'm not able to build the project, because it seems that gradle doesn't include the appcompat library while synching/building.

My dependencies in the build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.google.android.gms:play-services:+'
}

Also no play services are pulled into the project, but nine old androids is(I tried including different libraries, it seemed that everything from jcenter is downloaded) As you can see in the following screenshot:

external libraries

The gradle plugin is 1.0.0 and there are no problems during synching.
Are there any known solutions to such type of problem?

EDIT 1:
Android Support Repository
Android Support Library
Google Play Services
Are all installed. However it also works for newly created projects.

EDIT 2:

The ./gradlew build output:

Caused by: org.gradle.internal.UncheckedException: com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/stephan/Library/Android/sdk/build-tools/20.0.0/aapt package -f --no-crunch -I /Users/stephan/Library/Android/sdk/platforms/android-21/android.jar -M /Users/project-path/build/intermediates/manifests/full/flavor/beta/AndroidManifest.xml -S /Users/project-path/build/intermediates/res/flavor/beta -A /Users/project-path/build/intermediates/assets/flavor/beta -m -J /Users/project-path/build/generated/source/r/flavor/beta -F /Users/project-path/build/intermediates/res/resources-flavor-beta.ap_ --debug-mode --custom-package de.my.project -0 apk --output-text-symbols /Users/project-path/build/intermediates/symbols/flavor/beta
Error Code:
1
Output:
/Users/project-path/build/intermediates/res/flavor/beta/values/values.xml:2127: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base.Spinner'.
/Users/project-path/build/intermediates/res/flavor/beta/values-v16/values.xml:89: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base.Spinner'.

I also checked Widget.AppCompat.Light.Base.Spinner is part of the values.xml in appcompat-v7 20.0.0
Here are the sdk versions:

compileSdkVersion "Google Inc.:Google APIs:21"
buildToolsVersion "20.0.0"

defaultConfig {
    minSdkVersion 10
    targetSdkVersion 17
}



EDIT 3:

Project root build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


App build.gradle

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.google.android.gms:play-services:+'

}

android {
    compileSdkVersion "Google Inc.:Google APIs:21"
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 17
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
    }

    signingConfigs {
        conf1 {
            storeFile file("path")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }

        debug {
            storeFile file("path")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

    buildTypes {
        debug {
            zipAlignEnabled true
            minifyEnabled false
            proguardFile getDefaultProguardFile('proguard-android.txt')
            proguardFile 'proguard-project.txt'
            signingConfig signingConfigs.debug
        }

        release {
            zipAlignEnabled true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
            proguardFiles 'proguard-rules.pro'
        }

        beta {
            initWith debug
            signingConfig signingConfigs.debug
        }
    }

    productFlavors {
        flavor1 {
            applicationId "de.package"
            versionCode 1
            versionName "1.0"
            signingConfig signingConfigs.conf1
        }
    }


    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}
like image 338
Stephan Avatar asked Jul 29 '15 11:07

Stephan


People also ask

What is AppCompat V7 in Android?

Android AppCompat Library V7 The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.

What does AppCompat mean?

When new versions of android are published, Google will have to support the older versions of android. So AppCompat is a set of support libraries which can be used to make the apps developed with newer versions work with older versions.

What is the use of AppCompat?

An Android support library that enables the use of the ActionBar and Material Design specific implementations such as Toolbar for older devices down to Android v2.


1 Answers

I read the documentation for the Android appcompat library and it says that this library depends of v4 support library so you need include this in your project this is the link :https://developer.android.com/tools/support-library/features.html

You only need to change the dependencies in the build.gradle file and add the following line
compile 'com.android.support:support-v4:22.2.1' You can change the version(22.2.1) and put the version 20.0.0 if you want

like image 76
Kiko Blanco Avatar answered Oct 31 '22 17:10

Kiko Blanco