我有一些AnimatedVectorDrawables,我已经工作了一个月左右没有失败。今天我创建了另外两个这样的avds,其中一个导致了这个" Resource $ NotFoundException"。
我以与其他avds完全相同的方式访问它,它与其他avds位于同一位置,并且我以与其他avds相同的方式创建它。关于这一个的唯一特别之处是" startOffset"在其中一个objectAnimators上。我尝试删除该行,但错误仍然存在。我已经尝试重命名文件,将xml复制粘贴到我知道正在工作的另一个动画中,但这些都导致崩溃,这让我认为它是资源xml中的东西,但我不能发现任何东西。
这是堆栈跟踪:
android.content.res.Resources$NotFoundException: Drawable com.swerly.mypackage:drawable/test_avd with resource ID #0x7f0700ce
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/test_avd.xml from drawable resource ID #0x7f0700ce
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:768)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:600)
at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
at android.content.res.Resources.getDrawable(Resources.java:818)
at android.content.Context.getDrawable(Context.java:605)
at com.swerly.wifiheatmap.FabHelper.setAndPlay(FabHelper.java:74)
at com.swerly.wifiheatmap.FabHelper.setupFab(FabHelper.java:65)
at com.swerly.wifiheatmap.ActivityMain.backNavigation(ActivityMain.java:82)
at com.swerly.wifiheatmap.ActivityMain.onBackPressed(ActivityMain.java:51)
at android.app.Activity.onKeyUp(Activity.java:2965)
at android.view.KeyEvent.dispatch(KeyEvent.java:2712)
at android.app.Activity.dispatchKeyEvent(Activity.java:3257)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:537)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:336)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:351)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4714)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4586)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4181)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4274)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4155)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4331)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4181)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4155)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4128)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4181)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4307)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4468)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2435)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1998)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1989)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2412)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.res.Resources$NotFoundException: Drawable com.swerly.wifiheatmap:drawable/$test_avd__0 with resource ID #0x7f070026
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/$test_avd__0.x
以下是avd的代码: [编辑:问题是" pathData"字段由于某种原因未被导出]
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group
android:name="group"
android:pivotX="12"
android:pivotY="12">
<path
android:name="path"
android:pathData=""
android:fillColor="#000000"/>
<path
android:name="path_1"
android:pathData=""
android:fillColor="#000000"/>
</group>
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="pathData"
android:duration="500"
android:valueFrom="M 17 3 L 5 3 C 3.89 3 3 3.9 3 5 L 3 12 C 3 14.333 3 16.667 3 19 C 3 20.1 3.89 21 5 21 C 9.667 21 14.333 21 19 21 C 20.1 21 21 20.1 21 19 L 21 7 C 19.667 5.667 18.333 4.333 17 3 L 17 3 M 9 16 C 9 14.34 10.34 13 12 13 C 13.66 13 15 14.34 15 16 C 15 17.66 13.66 19 12 19 L 12 19 C 10.34 19 9 17.66 9 16 M 5 9 L 5 5 L 15 5 L 15 9 L 15 9 L 5 9"
android:valueTo="M 7 6 L 5.6 7.4 C 7.133 8.933 8.667 10.467 10.2 12 L 5.6 16.6 C 6.067 17.067 6.533 17.533 7 18 C 7.667 17.333 8.333 16.667 9 16 C 9.667 15.333 10.333 14.667 11 14 C 11.667 13.333 12.333 12.667 13 12 L 11 10 C 10.333 9.333 9.667 8.667 9 8 L 7 6 M 8 16 C 8 16 8 16 8 16 C 8 16 8 16 8 16 C 8 16 8 16 8 16 L 8 16 C 8 16 8 16 8 16 M 8 8 L 8 8 L 8 8 L 8 8 L 8 8 L 8 8"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="path_1">
<aapt:attr name="android:animation">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="pathData"
android:startOffset="175"
android:duration="325"
android:valueFrom="M 17 12 L 17 12 L 17 12 L 17 12 L 17 12 L 17 12 L 17 12"
android:valueTo="M 16.2 12 L 11.6 16.6 L 13 18 L 19 12 L 13 6 L 11.6 7.4 L 16.2 12"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="group">
<aapt:attr name="android:animation">
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="rotation"
android:duration="100"
android:valueFrom="0"
android:valueTo="360"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
答案 0 :(得分:1)
我明白了。显然我使用的软件由于某种原因将“pathData”字段留空了这个导出-_-