0

I activated the resouce shrinking in my build.gradle but now my embeded wearable app is stripped out. How can I avoid that my micro app is removed, because it is unused?

Skipped unused resource res/raw/android_wear_micro_apk.apk: 382310 bytes

Since I want to shrink the other not used resouces I'm using this DSL:

buildTypes {
    release {
        shrinkResources true
        // ...
    }
}

I would guess that I need to use proguard but I have no idea how to achieve that. I checked of cause the documentation, but I didn't get it how protect a single member variable.

rekire
  • 47,260
  • 30
  • 167
  • 264
  • This is probably a bug. You might file an issue at http://b.android.com. Or, if you don't have many other raw resources, try keeping your entire `R.raw` class. – CommonsWare Nov 03 '14 at 12:07
  • I would assume that something like `-keep class your.package.name.here.R.raw.** { *; }` would work in your ProGuard configuration file. Note that this would be your actual `package` value from the manifest for whatever package has this raw resource. Given [this issue](https://code.google.com/p/android/issues/detail?id=78617) I am skeptical that my suggestion will work, but it is at least worth a try. – CommonsWare Nov 03 '14 at 12:18

2 Answers2

1

Are you referencing the R.raw.apkpath? Looking at the Packaging Wearable Apps training mentions rawPathResId in the res/xml/wearable_app_desc.xml

On a side note enabling proGuard is simple with Gradle

 buildTypes {

        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
}
scottyab
  • 23,621
  • 16
  • 94
  • 105
  • At first `runProguard` is deprecated. Secondly I was looking for a proguard rule and not how to enabled it in general. – rekire Nov 03 '14 at 13:32
1

This is Bug 78620 and was fixed in the gradle build tools 0.14.1.

rekire
  • 47,260
  • 30
  • 167
  • 264