As play store doesn't provide me the permission to upload one apk with a targetSdkVersion of 25. So, I upgraded my targetSdkVersion from 25 to 27 and downloaded the all necessary libraries by adding dependencies.
I am provided below the entire build.gradle file code with the changes I made-
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.myApp"
minSdkVersion 17
targetSdkVersion 27
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
repositories {
mavenCentral()
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.jakewharton:butterknife:8.4.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.makeramen:roundedimageview:2.2.1'
implementation 'com.github.whinc:ratingbar:1.1.1'
implementation 'com.iarcuschin:simpleratingbar:0.1.3'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'in.srain.cube:grid-view-with-header-footer:1.0.12'
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.uncopt:android.justified:1.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.bluejamesbond:textjustify-android:2.1.6'
androidTestImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}
But after syncing I am getting the following errors-
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar] C:\Users\admin.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\ad0857f7c335bc06a588407b354d6c8b\res\values\values.xml
Error:(251, 5) error: duplicate value for resource 'attr/font' with config ''.
Error:(251, 5) error: resource previously defined here.
K:\my-app\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(484) duplicate value for resource 'attr/font' with config ''.
Error:(459) resource previously defined here.
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Information:BUILD FAILED in 9s Information:6 errors Information:0 warnings Information:See complete output in console
As I can't rollback back to targetSdkVersion 25.Please suggest me any solution to solve this issue and upgrade targetSdkVersion to 27.
a) you need to use the correct build-tools, which are version 27.0.3
. while I merely wonder why you updated to API 27
instead of the current API 28
; this would use build-tools version 28.0.3
.
b) and you have to fix these invalid resources; one duplicate attr/font
clashes with com.android.support:appcompat-v7:27.1.0
. this comes from any occurrence of <attr name="font" format="string"/>
in the project's XML, which has to be removed or renamed.
c) adding the buildscript
(most likely twice) into the module-level build.gradle
is non-sense. apply plugin: 'com.android.application'
also exists twice; this build.gradle
is a mess.