6

Getting issue when trying to build apk.

Android studio version - 4.0 (recently updated AS)

This process shows the error in build - :app:processDebugResources Android resource linking failed AAPT: unknown option '--no-proguard-location-reference'.

aapt2 link [options] -o arg --manifest arg files...

Options: -o arg Output path. --manifest arg Path to the Android manifest to build. -I arg Adds an Android APK to link against. -A arg An assets directory to include in the APK

Trying to build apk by with Build APK option from Build Menu in android studio

Gradle project file

classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
Deepak Rathi
  • 129
  • 1
  • 8
  • Android studio version? Gradle version? Also add more details on your build script, are you passing this custom argument by yourself? Are you using any third party plugins? What led to this problem: did you update anything, or change anything whatsoever? How are you building the APK? – Nicolas Jun 12 '20 at 20:01
  • hi @Nicolas I have updated the question, also i am using android studio 4.0 - recently updated, Building apk via build apk option from Build menu I am not passing any such arguments – Deepak Rathi Jun 13 '20 at 11:11

2 Answers2

12

if you have : "_internal_aapt2_binary" in gradle file (for earlier versions of gradle) then just remove that.

configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
    config.resolutionStrategy.eachDependency { details ->
        details.useVersion("3.5.0-alpha03-5252756")
    }
}
Charodey
  • 121
  • 2
0

There was some issue with proguard rules, in some rules there were some extra space and in other rules, i just have to delete them and re-write them manually instead of copy-paste from web page.

Strange issue, took a lot of time to identify such silly issues, @android should do something about such proguard issues, at least spaces at the end could be trimmed automatically.

Deepak Rathi
  • 129
  • 1
  • 8