我想在Android应用程序中向xml布局添加视图,首先我使用apktool v2.3.4反编译我的apk文件,然后将我的图片添加到drawables文件夹中。然后添加这样的图像视图:
<ImageView android:id="@id/button1" android:visibility="visibile" android:layout_width="@dimen/feedback_item_width" android:layout_height="@dimen/feedback_item_bold_height" android:src="@drawable/baseline_image_24" android:scaleType="center" android:layout_toLeftOf="@id/feed_button_extra" android:layout_toStartOf="@id/feed_button_extra" />
当我运行apktool build命令创建新的apk文件时,看到此错误:
S: WARNING: Could not write to (C:\Users\system-pc1\AppData\Local\apktool\framework), using C:\Users\SYSTEM~1\AppData\Local\Temp\ instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
W: S:\SampleApp\.\DecompileWithResources\res\layout\row_feed_media_ufi_bar_bold.xml:10: error: Error: No resource found that matches the given name (at 'id' with value '@id/button1').
W:
W: S:\SampleApp\.\DecompileWithResources\res\layout\row_feed_media_ufi_bar_bold.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/button1').
W:
W: S:\SampleApp\.\DecompileWithResources\res\layout\row_feed_media_ufi_bar_bold.xml:11: error: Error: No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/button1').
W:
W: S:\SampleApp\.\DecompileWithResources\res\layout\row_feed_media_ufi_bar_bold.xml:11: error: Error: No resource found that matches the given name (at 'layout_toStartOf' with value '@id/button1').
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\SYSTEM~1\AppData\Local\Temp\brut_util_Jar_435818997240085741.tmp, p, --forced-package-id, 127, --min-sdk-version, 19, --target-sdk-version, 26, --version-code, 133633072, --version-name, 73.0.0.22.185, --no-version-vectors, -F, C:\Users\SYSTEM~1\AppData\Local\Temp\APKTOOL7758442622303888258.tmp, -0, assets/SampleAppBundle.js.hbc.xz, -0, png, -0, webp, -0, jpg, -0, jpeg, -0, r/10.g.png, -0, r/4j.g.png, -0, r/_4.g.png, -0, r/b--.g.png, -0, r/b-p.g.png, -0, r/b05.g.png, -0, r/b7y.g.png, -0, r/b9-.g.png, -0, m4a, -0, r/bhq.g.png, -0, r/bhv.g.png, -0, r/bi9.g.png, -0, r/bn-.g.png, -0, r/bnb.g.png, -0, r/bnn.g.png, -0, r/bon.g.png, -0, r/bp8.g.png, -0, r/bp9.g.png, -0, r/brc.g.png, -0, r/bs2.g.png, -0, mp4, -0, r/bto.g.png, -0, r/by_.g.png, -0, r/ciz.g.png, -0, r/cj3.g.png, -0, r/ck3.g.png, -0, r/ckj.g.png, -0, r/cmp.g.png, -0, r/cnz.g.png, -0, r/cor.g.png, -0, r/ct8.g.png, -0, r/cte.g.png, -0, r/cu4.g.png, -0, r/cx.g.png, -0, r/cx3.g.png, -0, r/cya.g.png, -0, r/e0.g.png, -0, r/fd.g.png, -0, r/go.g.png, -0, r/io.g.png, -0, r/lc.g.png, -0, r/nc.g.png, -0, r/qh.g.png, -0, json, -0, r/uq.g.png, -0, r/ya.g.png, -0, r/zw.g.png, -0, arsc, -I, C:\Users\SYSTEM~1\AppData\Local\Temp\1.apk, -S, S:\SampleApp\.\DecompileWithResources\res, -M, S:\SampleApp\.\DecompileWithResources\AndroidManifest.xml]
I: Using Apktool 2.3.4
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_assets folder into assets.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether resources has changed...
I: Building resources...
答案 0 :(得分:0)
您必须将ID添加到您的ids.xml
中。 XML位于res/values/
下。
<item type="id" name="ir_row_feed_button_extra">false</item>