androidshrinkresources

protect resources when using shrinkResources


I am trying out the new feature from the build-plugin - unfortunately it removes my sounds from res/raw even though they are referenced in the code. Is there a way to protect resources from being removed?

EDIT - after playing around a bit - it seems that this feature is not yet mature and ready to use - another Project it removes needed layout xml from the support lib:

D/PassAndroid( 7137): Writing unhandled exception to:

/data/data/org.ligi.passandroid/files/2.4.2-1414944524128.tracedroid
D/PassAndroid( 7137): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.ligi.passandroid/org.ligi.passandroid.ui.PassListActivity}: android.content.res.Resources$NotFoundException: File res/layout/abc_screen_toolbar.xml from xml type layout resource ID #0x7f030013
D/PassAndroid( 7137):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
D/PassAndroid( 7137):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2464)
D/PassAndroid( 7137):   at android.app.ActivityThread.access$900(ActivityThread.java:172)
D/PassAndroid( 7137):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
D/PassAndroid( 7137):   at android.os.Handler.dispatchMessage(Handler.java:102)
D/PassAndroid( 7137):   at android.os.Looper.loop(Looper.java:146)
D/PassAndroid( 7137):   at android.app.ActivityThread.main(ActivityThread.java:5653)
D/PassAndroid( 7137):   at java.lang.reflect.Method.invokeNative(Native Method)
D/PassAndroid( 7137):   at java.lang.reflect.Method.invoke(Method.java:515)
D/PassAndroid( 7137):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
D/PassAndroid( 7137):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
D/PassAndroid( 7137):   at dalvik.system.NativeStart.main(Native Method)
D/PassAndroid( 7137): Caused by: android.content.res.Resources$NotFoundException: File res/layout/abc_screen_toolbar.xml from xml type layout resource ID #0x7f030013
D/PassAndroid( 7137):   at android.content.res.Resources.loadXmlResourceParser(Resources.java:3659)
D/PassAndroid( 7137):   at android.content.res.Resources.loadXmlResourceParser(Resources.java:3606)
D/PassAndroid( 7137):   at android.content.res.Resources.getLayout(Resources.java:2121)
D/PassAndroid( 7137):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
D/PassAndroid( 7137):   at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
D/PassAndroid( 7137):   at android.support.v7.app.ActionBarActivityDelegateBase.q(Unknown Source)
D/PassAndroid( 7137):   at android.support.v7.app.ActionBarActivityDelegateBase.a(Unknown Source)
D/PassAndroid( 7137):   at android.support.v7.app.ActionBarActivity.setContentView(Unknown Source)
D/PassAndroid( 7137):   at org.ligi.passandroid.ui.PassListActivity.onCreate(Unknown Source)
D/PassAndroid( 7137):   at android.app.Activity.performCreate(Activity.java:5541)
D/PassAndroid( 7137):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
D/PassAndroid( 7137):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2368)
D/PassAndroid( 7137):   ... 11 more
D/PassAndroid( 7137): Caused by: java.io.FileNotFoundException: res/layout/abc_screen_toolbar.xml
D/PassAndroid( 7137):   at android.content.res.AssetManager.openXmlAssetNative(Native Method)
D/PassAndroid( 7137):   at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:488)
D/PassAndroid( 7137):   at android.content.res.Resources.loadXmlResourceParser(Resources.java:3637)
D/PassAndroid( 7137):   ... 22 more

Solution

  • This is Bug 78617 and should been fixed in the latest gradle build tools