Skip to content

[Bug]: Android use proguard-android-optimize.txt? (Capacitor 8 + Android 16) #36

@MEDIUM-ch

Description

@MEDIUM-ch

Required Reading

  • Confirmed

Plugin Version

8.0.0

Cap Doctor

Installed Dependencies:

  @capacitor/cli: 8.1.0
  @capacitor/core: 8.1.0
  @capacitor/android: 8.1.0
  @capacitor/ios: 8.1.0

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

any

Device operating-systems(s)

Android 16 (16kb Support?)

What happened?

I try to build an APK for Capacitor 8.0, Android 16 and hopefully 16kb Support (not sure if this is relevant).

During build I get the message that using "proguard-android-optimize.txt" should be used instead of "proguard-android.txt" in built.gradle. I actually changed this in the 8.0.0 version of this package but I also had to remove refererences to "proguard_rules.pro" as that file somehow gets deleted during build (?!).

The following parts in build.gradle work but am totally unsure if this is a workable solution?

defaultConfig {
        minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
        targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        // consumerProguardFiles 'proguard-rules.pro'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }

BTW, I also added "-optimize" to the build.gradle in "@transistorsoft/capacitor-background-geolocation": "8.0.1" which seems to work without any other change.

I am no Android pro so maybe this a totally wrong but any help is apprecciated, thanks!

(P.S.: Almost all "required reading" links above are not available...)

Plugin Code and/or Config

not relevant as build process is affected only

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions