英文:
Android resource linking failed only on my foreground drawables not my background ones
问题
我正在尝试创建一个.aab文件以将我的应用程序发布到Play商店,但我在底部导航的前景可绘制对象上遇到了Android资源链接失败的问题。
一个可绘制对象的XML示例:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#000000">
<group android:scaleX="2.61"
android:scaleY="2.61"
android:translateX="22.68"
android:translateY="22.68">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</group>
</vector>
我的底部导航XML:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="Home"
android:icon="@drawable/ic_home_foreground"/>
<item
android:id="@+id/workout"
android:title="Workout"
android:icon="@drawable/ic_workout_foreground"/>
<item
android:id="@+id/history"
android:title="History"
android:icon="@drawable/ic_history_foreground"/>
</menu>
希望这些信息对您有所帮助。
英文:
I am trying to create an .aab file to post my app to play store but im getting a android resource linking failed on only my foreground drawbales of my bottom navigation,
xml of one of the drawables:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#000000">
<group android:scaleX="2.61"
android:scaleY="2.61"
android:translateX="22.68"
android:translateY="22.68">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</group>
</vector>
My bottom nav xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/home"
android:title="Home"
android:icon="@drawable/ic_home_foreground"/>
<item
android:id="@+id/workout"
android:title="Workout"
android:icon="@drawable/ic_workout_foreground"/>
<item
android:id="@+id/history"
android:title="History"
android:icon="@drawable/ic_history_foreground"/>
</menu>
答案1
得分: 1
你可能将资源添加到了调试文件夹中 - 这意味着你可以从Android Studio运行应用的调试版本,但当你尝试创建发布版本时,编译器找不到该资源。请检查你的资源父文件夹/查找器/资源管理器,如果是这样的话,将你的资源文件从
app/src/debug/resources/drawable/
移动到
app/src/main/resources/drawable/
英文:
Probably you added your resources in debug folder - which means that you can run the debug version of the app from android studio, but when you try to create a release one the compiler can not find the resource. Check your resource parent folder/finder/explorer and if so ^^, move your resource file
from
> app/src/debug/resources/drawable/
to
> app/src/main/resources/drawable/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论