0

My application was running fine when using SDK version 23. I tried to upgrade it to SDK version 26 but got build errors. The build gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    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/CHANGES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    defaultConfig {
        applicationId "com.futuremobilitylabs.incentrip"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 82
        versionName "0.8.113"
        multiDexEnabled true
        testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "2048M"
    }
    configurations {
        all*.exclude module: 'mediarouter-v7'
        all*.exclude module: 'support-compat'
        compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
    // http://jakewharton.github.io/butterknife/
    // https://github.com/daimajia/AndroidSwipeLayout
    //compile "com.daimajia.swipelayout:library:1.2.0@aar"
    compile 'ch.acra:acra:4.9.1'
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:design:26.0.0'
    compile 'com.android.support:recyclerview-v7:26.0.0'
    compile 'com.android.support:support-v4:26.0.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.google.android.gms:play-services-gcm:10.2.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.maps.android:android-maps-utils:0.3.+'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.jakewharton:butterknife:8.5.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.uber.sdk:rides-android:0.5.3'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'org.jsoup:jsoup:1.10.3'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}




apply plugin: 'com.google.gms.google-services'

The build error I got:

build failed 8s 664ms Run build 8s 531ms Load build 12ms Configure build 110ms Calculate task graph 98ms Run tasks 8s 307ms The specified Android SDK Build Tools version (26.0.0) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.2 will be used. To suppress this warning, remove "buildToolsVersion '26.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. resource style/TextAppearance.Compat.Notification.Info (aka com.app.application:style/TextAppearance.Compat.Notification.Info) not found. resource style/TextAppearance.Compat.Notification (aka com.app.application:style/TextAppearance.Compat.Notification) not found. resource style/TextAppearance.Compat.Notification.Time (aka com.app.application:style/TextAppearance.Compat.Notification.Time) not found. resource style/TextAppearance.Compat.Notification.Title (aka com.app.application:style/TextAppearance.Compat.Notification.Title) not found. failed linking references.
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

I have read some posts but couldn't fix this issue: Android SDK 26 build error, Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)

How can I resolve this issue?

Abner Escócio
  • 2,697
  • 2
  • 17
  • 36
  • https://stackoverflow.com/questions/48241620/errorresource-style-textappearance-compat-notification-info-aka-packageid-te – Zun Jul 09 '18 at 13:08
  • 1
    _To suppress this warning, remove "buildToolsVersion '26.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools._ Try this which is given in your error log. – Viraj Patel Jul 09 '18 at 13:17
  • @ZUNJAE I checked the post. However, I didn't use android:textAppearance="@style/TextAppearance.AppCompat.Notification" in the project. Instead, I used android:textAppearance="?android:attr/textAppearanceMedium". So I can't fix the issue. – Liang Tang Jul 09 '18 at 19:39
  • @VirajPatel Thanks. I can suppress the warning by doing so. Do you have any suggestions to fix the errors? – Liang Tang Jul 09 '18 at 19:42

1 Answers1

1

The problem is in the following line.

all*.exclude module: 'support-compat'

Remove it and use the following code to exclude support-v4 library.

all*.exclude module: 'support-v4'  

or

all*.exclude group: 'com.android.support', module: 'support-v4'  

You can also exclude support-v4 from specific library as below:

compile ('com.jakewharton:butterknife:8.5.1'){
        exclude group: 'com.android.support', module:'support-v4'
    }
Viraj Patel
  • 2,113
  • 16
  • 23
  • Thanks! I followed your first suggestion. The original build errors are gone. However, I got other errors as following: error: cannot access TaskStackBuilder class file for android.support.v4.app.TaskStackBuilder not found. error: cannot access FragmentActivity class file for android.support.v4.app.FragmentActivity not found. error: cannot find symbol class Fragment. error: cannot find symbol class LoaderManager. I guess that's because 'support-v4' is excluded while I do use a lot of functions from this module. Any suggestions how to address this problem? Thanks – Liang Tang Jul 11 '18 at 13:42
  • @LiangTang Remove `configurations {...}` code and exclude support-v4 library from individual libraries like describe above for butterknife library. Using `configurations {...}` is not recommended. – Viraj Patel Jul 22 '18 at 11:45