3
我正在嘗試構建插件的新功能 - 不幸的是,它刪除了res/raw中的聲音,即使它們在代碼中被引用。有沒有辦法保護資源不被移除?使用shrinkResources保護資源
編輯 - 玩弄了一下後 - 似乎這功能尚未成熟,並準備使用 - 另一個項目從支撐lib中刪除需要佈局的xml:
d/PassAndroid(7137):寫作未處理的異常:
/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
是他們在代碼('R.raw.boom_goes_the_dynamite')引用的「正常」,或者是你使用反射等東西來獲得'R.raw'值? – CommonsWare 2014-11-02 14:36:00
沒有反射 - 用於像R.raw.boom - 這裏的實際代碼:https://github.com/ligi/gobandroid/blob/master/android/src/main/java/org/ligi/gobandroid_hd/ui/GoSoundManager .java#L41 – ligi 2014-11-02 14:45:32
然後,聽起來像是一個錯誤。如果您在這裏沒有得到幫助,請嘗試使用'adt-dev' Google Group,或者在http://b.android.com上提出問題(因爲工具團隊相當關注他們的問題)。 – CommonsWare 2014-11-02 14:51:51