How to create release build for Android 8.1 with Capacitor 3.4.0 (error: "App not installed")

Hi community,

As I am relatively new to Capacitor and Android Studio I hope I am at the right place for help.

I am creating an application with Vue (2) and Capacitor 3.4.0
Default settings (variables) seems to be injected as:

  • minSdkVersion: 21
  • compileSdkVersion: 30
  • targetSdkVersion: 30

when running the debug version from Android Studio everything works fine on my Android 8.1 device.
even with compile/target level 30 (while Android 8.1 has level 27)

when creating a release build (signed and unsigned) both are compiling and creating the APK.
when opening either of those two, the staging is done, installing is done, (and with the signed APK I get an ‘are you sure’ message when ‘installing’ is almost done; “install anyway”)…
I get the (in)famous “App not installed” error.

My guess is it has to do with the Android level targeting, as Android 8.1 support only up to 27

  • compileSdkVersion: 30
  • targetSdkVersion: 30

Question 1: why is the debug version running smoothly on level 27 with compile/target version set to 30?

When changing the compile/target levels to 27 I get compile errors in the build output.

Executing tasks: [:app:assembleDebug] in project ****/product-explorer/android


> Configure project :app
AGPBI: {"kind":"warning","text":"Using flatDir should be avoided because it doesn't support any meta-data formats.","sources":[{}]}

> Configure project :capacitor-cordova-android-plugins
AGPBI: {"kind":"warning","text":"Using flatDir should be avoided because it doesn't support any meta-data formats.","sources":[{}]}

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :capacitor-android:preBuild UP-TO-DATE
> Task :capacitor-android:preDebugBuild UP-TO-DATE
> Task :capacitor-android:compileDebugAidl NO-SOURCE
> Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
> Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
> Task :capacitor-cordova-android-plugins:compileDebugAidl NO-SOURCE
> Task :capacitor-splash-screen:preBuild UP-TO-DATE
> Task :capacitor-splash-screen:preDebugBuild UP-TO-DATE
> Task :capacitor-splash-screen:compileDebugAidl NO-SOURCE
> Task :capacitor-status-bar:preBuild UP-TO-DATE
> Task :capacitor-status-bar:preDebugBuild UP-TO-DATE
> Task :capacitor-status-bar:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :capacitor-android:packageDebugRenderscript NO-SOURCE
> Task :capacitor-cordova-android-plugins:packageDebugRenderscript NO-SOURCE
> Task :capacitor-splash-screen:packageDebugRenderscript NO-SOURCE
> Task :capacitor-status-bar:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:javaPreCompileDebug
> Task :capacitor-android:writeDebugAarMetadata
> Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
> Task :capacitor-splash-screen:writeDebugAarMetadata
> Task :capacitor-status-bar:writeDebugAarMetadata
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :capacitor-android:compileDebugRenderscript NO-SOURCE
> Task :capacitor-android:generateDebugResValues
> Task :capacitor-android:generateDebugResources
> Task :capacitor-android:packageDebugResources
> Task :capacitor-cordova-android-plugins:compileDebugRenderscript NO-SOURCE
> Task :capacitor-cordova-android-plugins:generateDebugResValues
> Task :capacitor-cordova-android-plugins:generateDebugResources
> Task :capacitor-cordova-android-plugins:packageDebugResources
> Task :capacitor-splash-screen:compileDebugRenderscript NO-SOURCE
> Task :capacitor-splash-screen:generateDebugResValues
> Task :capacitor-splash-screen:generateDebugResources
> Task :capacitor-splash-screen:packageDebugResources
> Task :capacitor-status-bar:compileDebugRenderscript NO-SOURCE
> Task :capacitor-status-bar:generateDebugResValues
> Task :capacitor-status-bar:generateDebugResources
> Task :capacitor-status-bar:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :capacitor-android:extractDeepLinksDebug
> Task :capacitor-cordova-android-plugins:extractDeepLinksDebug
> Task :capacitor-android:processDebugManifest
> Task :capacitor-cordova-android-plugins:processDebugManifest
> Task :capacitor-splash-screen:extractDeepLinksDebug
> Task :app:checkDebugAarMetadata
> Task :capacitor-status-bar:extractDeepLinksDebug
> Task :capacitor-android:compileDebugLibraryResources
> Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
> Task :capacitor-splash-screen:compileDebugLibraryResources
> Task :capacitor-status-bar:processDebugManifest
> Task :capacitor-splash-screen:parseDebugLocalResources
> Task :capacitor-status-bar:compileDebugLibraryResources
> Task :capacitor-splash-screen:processDebugManifest
> Task :capacitor-android:parseDebugLocalResources
> Task :capacitor-cordova-android-plugins:parseDebugLocalResources
> Task :capacitor-status-bar:parseDebugLocalResources
> Task :capacitor-android:generateDebugBuildConfig
> Task :capacitor-android:javaPreCompileDebug
> Task :capacitor-cordova-android-plugins:generateDebugBuildConfig
> Task :capacitor-cordova-android-plugins:javaPreCompileDebug
> Task :capacitor-splash-screen:generateDebugBuildConfig
> Task :capacitor-splash-screen:javaPreCompileDebug
> Task :capacitor-status-bar:generateDebugBuildConfig
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :capacitor-status-bar:javaPreCompileDebug
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :capacitor-cordova-android-plugins:generateDebugRFile
> Task :capacitor-android:mergeDebugShaders
> Task :capacitor-android:generateDebugRFile
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:mergeDebugResources
> Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac
> Task :capacitor-android:compileDebugShaders NO-SOURCE
> Task :capacitor-android:generateDebugAssets UP-TO-DATE
> Task :capacitor-cordova-android-plugins:bundleLibCompileToJarDebug
> Task :capacitor-android:packageDebugAssets
> Task :capacitor-cordova-android-plugins:mergeDebugShaders
> Task :capacitor-cordova-android-plugins:compileDebugShaders NO-SOURCE
> Task :capacitor-cordova-android-plugins:generateDebugAssets UP-TO-DATE
> Task :capacitor-cordova-android-plugins:packageDebugAssets
> Task :capacitor-splash-screen:mergeDebugShaders
> Task :capacitor-splash-screen:compileDebugShaders NO-SOURCE
> Task :capacitor-splash-screen:generateDebugAssets UP-TO-DATE
> Task :capacitor-splash-screen:packageDebugAssets
> Task :capacitor-status-bar:mergeDebugShaders
> Task :capacitor-status-bar:compileDebugShaders NO-SOURCE
> Task :capacitor-status-bar:generateDebugAssets UP-TO-DATE
> Task :capacitor-status-bar:packageDebugAssets
> Task :app:mergeDebugAssets
> Task :app:processDebugJavaRes NO-SOURCE
> Task :capacitor-android:processDebugJavaRes NO-SOURCE
> Task :capacitor-android:bundleLibResDebug NO-SOURCE
> Task :capacitor-cordova-android-plugins:processDebugJavaRes NO-SOURCE
> Task :capacitor-cordova-android-plugins:bundleLibResDebug NO-SOURCE
> Task :capacitor-splash-screen:processDebugJavaRes NO-SOURCE
> Task :capacitor-splash-screen:bundleLibResDebug NO-SOURCE
> Task :capacitor-status-bar:processDebugJavaRes NO-SOURCE
> Task :capacitor-status-bar:bundleLibResDebug NO-SOURCE
> Task :capacitor-splash-screen:generateDebugRFile
> Task :capacitor-status-bar:generateDebugRFile
> Task :app:mergeDebugJavaResource
> Task :app:compressDebugAssets

> Task :capacitor-android:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :app:processDebugManifestForPackage
> Task :app:desugarDebugFileDependencies
> Task :app:checkDebugDuplicateClasses
> Task :capacitor-android:bundleLibCompileToJarDebug
> Task :capacitor-android:bundleLibRuntimeToDirDebug
> Task :app:mergeDebugJniLibFolders
> Task :capacitor-android:mergeDebugJniLibFolders
> Task :capacitor-android:mergeDebugNativeLibs NO-SOURCE
> Task :capacitor-cordova-android-plugins:bundleLibRuntimeToDirDebug
> Task :capacitor-android:stripDebugDebugSymbols NO-SOURCE
> Task :capacitor-android:copyDebugJniLibsProjectOnly
> Task :capacitor-cordova-android-plugins:mergeDebugJniLibFolders
> Task :capacitor-cordova-android-plugins:mergeDebugNativeLibs NO-SOURCE
> Task :capacitor-cordova-android-plugins:stripDebugDebugSymbols NO-SOURCE
> Task :capacitor-cordova-android-plugins:copyDebugJniLibsProjectOnly
> Task :capacitor-splash-screen:mergeDebugJniLibFolders
> Task :capacitor-splash-screen:mergeDebugNativeLibs NO-SOURCE
> Task :capacitor-splash-screen:stripDebugDebugSymbols NO-SOURCE
> Task :capacitor-splash-screen:copyDebugJniLibsProjectOnly
> Task :capacitor-splash-screen:compileDebugJavaWithJavac
> Task :capacitor-splash-screen:bundleLibCompileToJarDebug
> Task :capacitor-status-bar:compileDebugJavaWithJavac
> Task :capacitor-status-bar:bundleLibCompileToJarDebug
> Task :capacitor-status-bar:mergeDebugJniLibFolders
> Task :capacitor-splash-screen:bundleLibRuntimeToDirDebug
> Task :capacitor-status-bar:mergeDebugNativeLibs NO-SOURCE
> Task :capacitor-status-bar:bundleLibRuntimeToDirDebug
> Task :capacitor-status-bar:stripDebugDebugSymbols NO-SOURCE
> Task :capacitor-status-bar:copyDebugJniLibsProjectOnly
> Task :app:mergeExtDexDebug
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE

> Task :app:processDebugResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml","position":{"startLine":4,"startColumn":4,"startOffset":217,"endLine":7,"endColumn":12,"endOffset":442}}],"original":"ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml","position":{"startLine":8,"startColumn":4,"startOffset":447,"endLine":11,"endColumn":12,"endOffset":684}}],"original":"ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml","position":{"startLine":141,"startColumn":4,"startOffset":8808,"endLine":172,"endColumn":24,"endOffset":10868}}],"original":"ERROR:/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml","position":{"startLine":141,"startColumn":4,"startOffset":8808,"endLine":172,"endColumn":24,"endOffset":10868}}],"original":"ERROR:/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values/values.xml","position":{"startLine":2770,"startColumn":4,"startOffset":173200,"endLine":2793,"endColumn":24,"endOffset":174397}}],"original":"ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values/values.xml:2771:5-2794:25: AAPT: error: resource android:attr/textFontWeight not found.\n    ","tool":"AAPT"}

> Task :app:mergeLibDexDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
         
     ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
         
     ERROR:/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
         
     ERROR:/Users/Remco/.gradle/caches/transforms-3/bb38d725adac671245a565f7873da5cd/transformed/core-1.3.2/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
         
     ERROR:/Users/Remco/.gradle/caches/transforms-3/d0765aaf7ad2db850fe88cd4a9d96261/transformed/appcompat-1.2.0/res/values/values.xml:2771:5-2794:25: AAPT: error: resource android:attr/textFontWeight not found.
         

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
91 actionable tasks: 91 executed

Other settings/variables in “project structure”:

  • androidxActivityVersion : 1.2.0
  • androidxAppCompatVersion : 1.2.0
  • androidxCoordinatorLayoutVersion : 1.1.0
  • androidxCoreVersion : 1.3.2
  • androidxFragmentVersion : 1.3.0
  • junitVersion : 4.13.1
  • androidxJunitVersion : 1.1.2
  • androidxEspressoCoreVersion : 3.3.0
  • cordovaAndroidVersion : 7.0.0

ALso get 25 suggestions for “updates” in the project structure window
I tried them all one by one, but some causes extra/other errors as well;
so I removed the ./android directory and started over multiple times.

Again, as I am new to this I am not sure what other information to provide. Currently I have read many posts and tried out lots of different things people recommended, without any luck so far.

Any help is appreciated a lot

Remco