lnln1111 / android-apktool

Automatically exported from code.google.com/p/android-apktool
Other
0 stars 0 forks source link

ICS Rebuild failed. #277

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Deodex MIUI
2. Decompile
3. Recompile

What is the expected output? What do you see instead?

http://pastebin.com/1FYxQq67

What version of the product are you using? On what operating system?

1.4.3, every OS. Centos, Windows 7, everything.

Please provide any additional information below.

Original issue reported on code.google.com by connor.tumbleson on 24 Dec 2011 at 4:40

GoogleCodeExporter commented 9 years ago
Update your aapt tool to a newest one. It can be found in SDK/platform-tools

Original comment by Brut.alll on 28 Dec 2011 at 12:39

GoogleCodeExporter commented 9 years ago
That still didn't work.

Original comment by iBotPeac...@gmail.com on 28 Dec 2011 at 1:28

GoogleCodeExporter commented 9 years ago
Having same problems, using latest aapt and apktool and everything releated is 
newest version.

Original comment by ivica.sk...@gmail.com on 28 Dec 2011 at 7:57

GoogleCodeExporter commented 9 years ago
I've attached the 3 APKs for help.

Original comment by iBotPeac...@gmail.com on 28 Dec 2011 at 7:19

Attachments:

GoogleCodeExporter commented 9 years ago
Everything is ok:

$ apktool if framework-res.apk t3
I: Framework installed to: /home/brutall/apktool/framework/1-t3.apk

$ apktool if framework-miui-res.apk t3
I: Framework installed to: /home/brutall/apktool/framework/3-t3.apk

$ apktool d -t t3 AntiSpam.apk 
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/brutall/apktool/framework/1-t3.apk
I: Loaded.
I: Loading resource table from file: /home/brutall/apktool/framework/3-t3.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

$ apktool b AntiSpam
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...

@iBotPeaches
I'm pretty sure "invalid resource directory name" for directories like 
values-sw600dp is caused by the outdated aapt tool. Recheck everything - maybe 
you have 2 aapt's in your PATH and older file covers newer one.

Original comment by Brut.alll on 28 Dec 2011 at 8:31

GoogleCodeExporter commented 9 years ago
Thanks for the continued help, but I forgot to say that

-AntiSpam works. I included it if you needed to test against a file that worked.

Try 
apktool d -t t3 framework-res.apk

then
apktool b framework-res

I just searched my computer and replaced every aapt with the 805kb new updated 
one. I double checked my paths and the issue still exists.

I'm not the only one with this problem, otherwise the new 1.12.23 versions of 
MIUI 4.0.3 would be coming out on various sites, but no one has been able to 
re-compile after translating.

The error again:

C:\Users\Connor\Desktop\Newfolder>apktool d framework-res.apk
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

C:\Users\Connor\Desktop\Newfolder>apktool b framework-res
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
C:\Users\Connor\Desktop\Newfolder\framework-res\res\values\plurals.xml:79: 
error: Multiple substitutions specified in non-positional format; did you mean 
to add the formatted="false" attribute?
C:\Users\Connor\Desktop\Newfolder\framework-res\res\values\plurals.xml:79: 
error: Found tag </item> where </plurals> is expected
C:\Users\Connor\Desktop\Newfolder\framework-res\res\values-zh-rCN\plurals.xml:79
: error: Multiple substitutions specified in non-positional format; did you 
mean to add the formatted="false" attribute?

C:\Users\Connor\Desktop\Newfolder\framework-res\res\values-zh-rCN\plurals.xml:79
: error: Found tag </item> where </plurals> is expected
Exception in thread "main" brut.androlib.AndrolibException: 
brut.common.BrutException: could not exec command: [aapt, p, -F, 
C:\Users\Connor\AppData\Local\Temp\APKTOOL7619123578063426414.tmp, -x, -S,
C:\Users\Connor\Desktop\Newfolder\framework-res\res, -M, 
C:\Users\Connor\Desktop\Newfolder\framework-res\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
        at brut.androlib.Androlib.buildResources(Androlib.java:248)
        at brut.androlib.Androlib.build(Androlib.java:171)
        at brut.androlib.Androlib.build(Androlib.java:154)
        at brut.apktool.Main.cmdBuild(Main.java:182)
        at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, 
C:\Users\Connor\AppData\Local\Temp\APKTOOL7619123578063426414.tmp, -x, -S, 
C:\Users\Connor\Desktop\Newfolder\framework-res\r
es, -M, C:\Users\Connor\Desktop\Newfolder\framework-res\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:83)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
        ... 6 more

Ran it as admin, tried everything.

Original comment by iBotPeac...@gmail.com on 28 Dec 2011 at 8:46

GoogleCodeExporter commented 9 years ago
@iBotPeaches
Ahh, finally I can reproduce an error :-)

Original comment by Brut.alll on 28 Dec 2011 at 9:42

GoogleCodeExporter commented 9 years ago
@brutall,

Can the problem be fixed?

Original comment by markhedl...@gmail.com on 29 Dec 2011 at 10:35

GoogleCodeExporter commented 9 years ago
@brut.all

Message from MIUI Devs on this framework plurals error...

"The tool cannot handle the string like "<item …> %d of  %d </item>", which 
contains two "%d". A workaround could be removing the second "%d", but it can 
result in a runtime error. :("

Original comment by markhedl...@gmail.com on 30 Dec 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Any updates on this? I'm eager to get ICS framework-res and SystemUI to compile.

Original comment by A.Akker...@gmail.com on 1 Jan 2012 at 8:34

GoogleCodeExporter commented 9 years ago
SystemUI doesnt pose any issue, we've discovered that something in the 1.4.3 
build broke the ICS sources so we need brut.alll to fix this up for 1.4.4 if he 
has time.

For now we are testing with a workaround to get framework building. Credit goes 
to iBotPeaches for his efforts on the new .jar file. We will post results soon, 
just need to find some time tomorrow with the busy time of the new year 
proceedings.

Cheers,

MarkHUK

Original comment by markhedl...@gmail.com on 1 Jan 2012 at 11:59

GoogleCodeExporter commented 9 years ago
We are still waiting! :O Please, we need a working build for ICS!

Original comment by janiself...@gmail.com on 3 Jan 2012 at 7:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
please read http://www.miui.nl/?page_id=2216
after correcting the source .xml files you can recompile, and then decompile 
and recompile again without errors.
tools used: apktool 1.4.3 and latest aapt.exe

Original comment by KJ.Logem...@gmail.com on 5 Jan 2012 at 6:29

GoogleCodeExporter commented 9 years ago
This isn't a fix, it is a very ugly workaround! As an example in AOSP you would 
need to change like 80 or more files by hand! A new apktool.jar is needed, and 
I am sure it isn't that much work.

Original comment by janiself...@gmail.com on 5 Jan 2012 at 6:42

GoogleCodeExporter commented 9 years ago
Still no working tool available...

Original comment by ljw...@gmail.com on 8 Jan 2012 at 12:12

GoogleCodeExporter commented 9 years ago
moving the aapt.exe from the newest android sdk tools to replace the one 
provided by apktool worked for me.

Original comment by A.Sch...@gmail.com on 9 Jan 2012 at 8:35

GoogleCodeExporter commented 9 years ago
"moving the aapt.exe from the newest android sdk tools to replace the one 
provided by apktool worked for me." 

Which aapt.exe did you take and where did you put it?
(please answer as exact as possible)

Original comment by janiself...@gmail.com on 10 Jan 2012 at 1:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
rebuild framework-res.apk in virtuous_quattro_beta7_saga,the same issue

Original comment by liubo.an...@gmail.com on 13 Jan 2012 at 8:22

GoogleCodeExporter commented 9 years ago
I took the aapt.exe from the Android sdk.  It was in the "platform tools" 
directory.  I replaced the one located in the apktool directory.  

The only thing i have been doing with it is modifying the systemui.apk   Before 
i moved the aapt.exe over i was getting the same error as everyone on build. 
After i was able to build the systemui.apk without errors.   

That's all i know! 

Original comment by A.Sch...@gmail.com on 18 Jan 2012 at 8:42

GoogleCodeExporter commented 9 years ago
This didn't work for me. Did you have to decompile the apk again after moving 
aapt.exe?

Original comment by JayLesli...@gmail.com on 19 Jan 2012 at 3:55

GoogleCodeExporter commented 9 years ago
It doesn't work for me too.

Original comment by delc...@gmail.com on 23 Jan 2012 at 12:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Replacing the aapt supplied with the aapt in the sdk did the trick for me, 
thanks!

Original comment by mathne...@gmail.com on 23 Jan 2012 at 2:49

GoogleCodeExporter commented 9 years ago
Had the same issue. Fixed when replacing aapt with newest. Make sure to 
decompile the apk again before attempting to build. Did not work with the 
previously decompiled one.

Original comment by nickmars...@gmail.com on 3 Feb 2012 at 9:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
"I took the aapt.exe from the Android sdk.  It was in the "platform tools" 
directory.  I replaced the one located in the apktool directory.  "

Worked like a charm for me! Thank You!

Original comment by pathe...@gmail.com on 4 Mar 2012 at 2:58

GoogleCodeExporter commented 9 years ago
"I took the aapt.exe from the Android sdk.  It was in the "platform tools" 
directory.  I replaced the one located in the apktool directory.  "

Worked like a charm for me as well! Thank You!

Original comment by SwissR...@gmail.com on 9 Mar 2012 at 8:28

GoogleCodeExporter commented 9 years ago
i found two different aapt.exe: with size of 11Mb and size of 800Kb
smallest one works for me, but i get errors in xmls, containing items such us 
"%d of %d":
with
    <plurals name="matches_found">
        <item quantity="other">%d of %d</item>
        <item quantity="one">1 match</item>
    </plurals>
i'v got error:
C:\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\plurals.xml:79
: error: Multiple substitutions specified in non-positional format; did you 
mean to add the formatted="false" attribute?
C:\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\plurals.xml:79
: error: Found tag </item> where </plurals> is expected

Original comment by alexande...@gmail.com on 14 Mar 2012 at 1:37

GoogleCodeExporter commented 9 years ago
Change it to:

%1$d of %2$d

Original comment by markhedl...@gmail.com on 14 Mar 2012 at 1:40

GoogleCodeExporter commented 9 years ago
I had the same issue with framework-res.apk. Just changing the aapt.exe didn't 
help. When i changed the (troublesome) plurals.xml as described in Comment 31, 
it worked.

Original comment by velimir....@calyx.hr on 20 Mar 2012 at 8:44

GoogleCodeExporter commented 9 years ago
any updates here ?!?!

Original comment by kleena...@gmail.com on 14 Apr 2012 at 10:29

GoogleCodeExporter commented 9 years ago
i had this problem, exception in main yadadadada

update your aapt. make sure sdk tools is updated to latest version for your 
android version your trying to build. go into platform-tools, look for 
aapt-backup, if its there (it was for me, and was the actual NEWER one)

do:

sudo su

cd home/USERNAME/DIRECTORY/SDK-IS-IN/platform-tools
cp aapt-backup /usr/local/bin/aapt

worked for me...

Original comment by YounGunn@gmail.com on 19 Apr 2012 at 6:15

GoogleCodeExporter commented 9 years ago
^^^of course this is in linux^^^

just if your a noob.
;-)

Original comment by YounGunn@gmail.com on 19 Apr 2012 at 7:17

GoogleCodeExporter commented 9 years ago

Original comment by connor.tumbleson on 15 Nov 2012 at 2:50

GoogleCodeExporter commented 9 years ago
Get aapt from https://github.com/MiCode/patchrom_tools/blob/jellybean/aapt
then it works.

Original comment by truly...@gmail.com on 16 Jan 2013 at 5:13