0

I have been working on a project for the past 2 years of which I have moved it to Android Studio since about last 1 year(I am using Android Studio 1.5.1 currently). Just today when I opened the project to run it I got Error retrieving parent for item: android:TextAppearance.Material.Widget.Button.Inverse and android:Widget.MaterialButton.Colored errors. The following is my app.gradle file:

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.opaxlabs.boatbrat"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 20
        versionName '2.0'
        multiDexEnabled true
//        ndk {
//            moduleName "password"
//            abiFilter "all"
//        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    dexOptions{
        preDexLibraries = false
    }

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

//    sourceSets.main.jni.srcDirs = [] // disable automatic ndk-build call, which ignore our Android.mk
//    sourceSets.main.jniLibs.srcDir 'src/main/libs'
//
//    // call regular ndk-build(.cmd) script from app directory
//    task ndkBuild(type: Exec) {
//        workingDir file('src/main')
//        commandLine getNdkBuildCmd()
//    }
//
//    tasks.withType(JavaCompile) {
//        compileTask -> compileTask.dependsOn ndkBuild
//    }
//
//    task cleanNative(type: Exec) {
//        workingDir file('src/main')
//        commandLine getNdkBuildCmd(), 'clean'
//    }
//
//    clean.dependsOn cleanNative

//    splits {
//        abi {
//            enable true
//            reset()
//            include 'x86', 'armeabi-v7a', 'mips'
//            universalApk true
//        }
//    }
}

//repositories {
//    jcenter()
//    maven { url "http://dl.bintray.com/webactive/maven" }
//}

//def getNdkDir() {
//    if (System.env.ANDROID_NDK_ROOT != null)
//        return System.env.ANDROID_NDK_ROOT
//
//    Properties properties = new Properties()
//    properties.load(project.rootProject.file('local.properties').newDataInputStream())
//    def ndkdir = properties.getProperty('ndk.dir', null)
//    if (ndkdir == null)
//        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
//
//    return ndkdir
//}
//
//def getNdkBuildCmd() {
//    def ndkbuild = getNdkDir() + "/ndk-build"
//    if (Os.isFamily(Os.FAMILY_WINDOWS))
//        ndkbuild += ".cmd"
//
//    return ndkbuild
//}

repositories {
    jcenter()
    maven { url "http://dl.bintray.com/webactive/maven" }
}

dependencies {
    compile 'com.android.support:multidex:1.0.0'
//    compile 'com.android.support:support-v4:+'
    compile 'com.google.android.gms:play-services:+'
//                {
//            exclude module: 'play-services-analytics'
//        }
//        compile ('com.google.android.gms:play-services-analytics:7.3.0')
    compile 'com.android.support:appcompat-v7:22.+'
//    compile 'com.stripe:stripe-android:+'
//    compile files('libs/PayPal_MPL.jar')
    compile files('libs/cwac-adapter-1.0.2.jar')
    compile files('libs/devsmartlib.jar')
    compile files('libs/fluent-hc-4.3.3.jar')
    compile files('libs/httpasyncclient-4.0.1.jar')
    compile files('libs/httpasyncclient-cache-4.0.1.jar')
    compile files('libs/httpclient-4.3.2.jar')
    compile files('libs/httpclient-cache-4.3.1.jar')
    compile files('libs/httpcore-4.3.2.jar')
    compile files('libs/httpmime-4.3.3.jar')
    compile files('libs/universal-image-loader-1.9.2-with-sources.jar')
    compile files('libs/endless-1.2.3.jar')
    compile files('libs/jncryptor-1.2.0.jar')
    compile files('libs/commons-codec-1.7-SNAPSHOT-android.jar')
    compile 'com.eway.payment:android-sdk:1.1'
}

I am using lower version build tools as the project has a lot of code that is deprecated and using later tools and sdk might complicate the problem. I even tried to build with version 23 but that did not help. I tried the following: This and this but they are essentially saying things I have already done. Any help will be greatly appreciated. Thanks in advance.

1 Answer 1

2

Since you are using

compile 'com.google.android.gms:play-services:+'

you are using the latest version compile 'com.google.android.gms:play-services:8.4.0' which has a dependency with support libraries v23.

You have to compile with API 23.

Change this line:

 compileSdkVersion 23

In general is not a good practice the use of + in your dependencies because you can't replicate the build in the future with the same libraries and you don't know which version you are using.

Sign up to request clarification or add additional context in comments.

2 Comments

The better advise is probably not to use + as a version.
changed the line to compile 'com.google.android.gms:play-services:6.5.87' and it worked perfectly. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.