desword / android-apktool

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

app not work after recompiled Galaxy S5 #714

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Decompile and recompile without any error
2.Put that recompiled app to phone, it's show "android" icon(the default icon 
for every app), not the original. Open that apps in phone will give force close.
3.

What is the expected output? What do you see instead?
Open \build\apk\res or open recompiled app with archiver and look in \res will 
see some folder were add -v4, -v13,-v21, etc... at end of name.

What version of the product are you using? On what operating system?
I'm use apktool_rc3 with java 1.7 on windows XP.

Please provide any additional information below.
I've using apktool for Samsung Galaxy S5.
Link below is original app "framework-res.apk" and recompiled 
"nframework-res.apk" and "log.txt" is decompile and recompile log(the warning: 
"W: Could not find sources" is not happen in SecSettings.apk).

https://drive.google.com/folderview?id=0B43W0MAI1AjkM0Y0akVEdnh1b3c&usp=sharing

Original issue reported on code.google.com by gemini16...@gmail.com on 1 Dec 2014 at 4:19

GoogleCodeExporter commented 9 years ago
Okay, this is strange.

This is not Apktool. Apktool decodes the resources without the version 
qualifier. On rebuild aapt adds those automatically into the qualifiers.

Basically if a qualifier is being used that is only in v13+ or v4+ then the 
version qualifier is automatically added. This should not affect a device at 
all.

Via this link: 
http://developer.android.com/guide/topics/resources/providing-resources.html

Note: Some configuration qualifiers have been added since Android 1.0, so not 
all versions of Android support all the qualifiers. Using a new qualifier 
implicitly adds the platform version qualifier so that older devices are sure 
to ignore it. For example, using a w600dp qualifier will automatically include 
the v13 qualifier, because the available-width qualifier was new in API level 
13. To avoid any issues, always include a set of default resources (a set of 
resources with no qualifiers). For more information, see the section about 
Providing the Best Device Compatibility with Resources.

Looking at it again with this knowledge. This looks like its a possibly of 
being one of the below.

1) A bug in the ROM you are using in reading qualifiers.
2) A bug in aapt, adding version qualifier to wrong folders
3) Not a bug, but a new restriction of aapt.

To confirm again, nothing in Apktool caused this.

Original comment by connor.tumbleson on 1 Dec 2014 at 11:55

GoogleCodeExporter commented 9 years ago
Issue 715 has been merged into this issue.

Original comment by connor.tumbleson on 1 Dec 2014 at 9:07

GoogleCodeExporter commented 9 years ago
seems that RC3 for 5.0 only, RC2 for 4.4 and previous

Original comment by ntflc2...@gmail.com on 4 Dec 2014 at 10:09

GoogleCodeExporter commented 9 years ago
So far this has been isolated to a Samsung problem.

Obviously I cannot dismiss a bug that affects so far at least the SGS4/SGS5 
family, but since I sold my SGS3 I'm at quite a lose of testing these problems 
first hand. I will need some support from those who duplicate this problem in 
terms of logcats of the installation process. Since I cannot duplicate on AOSP, 
CM or stock Sony.

So find a Samsung apk. Decode. Rebuild.

During install run (adb logcat). I will need logcat of the installation and of 
the FC to proceed. 

Thanks

Original comment by connor.tumbleson on 6 Dec 2014 at 4:55

GoogleCodeExporter commented 9 years ago
thanks for following still this.
i faced wrongly again this, just to enlight that i push the apps and do not 
install them.
Same apk folder recompiled with rc3, fc the app
rc2 all goes fine.

will provide both apks(before and after) and logcat of fc

Original comment by Cer...@gmail.com on 6 Dec 2014 at 5:05

GoogleCodeExporter commented 9 years ago
I've decompiled SamsungApp_K.apk, then rebuild. When i press to install, it's 
show Package installer has stoped.
i attach logcat and nSamsungApp_K.apk that i've rebuild here.

https://drive.google.com/folderview?id=0B43W0MAI1AjkM0Y0akVEdnh1b3c&usp=sharing
And here is log that i decoded and rebuilt:
D:\AdvancedApkTool41\1-BDFreak>java -jar apktool.jar d SamsungApps_K.apk
I: Using Apktool 2.0.0-RC3 on SamsungApps_K.apk
I: Loading resource table...
W: Skipping "android" package group
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Documents and Settings\Windows 
XP\apktool\framework\1.apk
Cleaning up unclosed ZipFile for archive C:\Documents and Settings\Windows 
XP\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

D:\AdvancedApkTool41\1-BDFreak>java -jar apktool.jar b SamsungApps_K -o 
nSamsungApps_K.apk
I: Using Apktool 2.0.0-RC3 on SamsungApps_K
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs...
I: Building apk file...
Cleaning up unclosed ZipFile for archive 
C:\DOCUME~1\WINDOW~1\LOCALS~1\Temp\APKTOOL2828505443008704690.tmp
I: Copying unknown files/dir...

Original comment by gemini16...@gmail.com on 9 Dec 2014 at 7:24

GoogleCodeExporter commented 9 years ago
Sorry, FC when install is broken of signature. I've sign with test key, but 
it's say "App not installed."
I upload again Signed_nSamsungApps_K.apk and logcat2.txt at
https://drive.google.com/folderview?id=0B43W0MAI1AjkM0Y0akVEdnh1b3c&usp=sharing

Original comment by gemini16...@gmail.com on 9 Dec 2014 at 7:32

GoogleCodeExporter commented 9 years ago
Issue 726 has been merged into this issue.

Original comment by connor.tumbleson on 14 Dec 2014 at 7:57

GoogleCodeExporter commented 9 years ago
@ Comment #7

The issue in your logcat has nothing to do with these extra version qualifiers. 
It seems there is a signing error.

E/AndroidRuntime( 7597): Caused by: java.lang.SecurityException: 
META-INF/MANIFEST.MF has invalid digest for AndroidManifest.xml in 
/storage/emulated/0/nSamsungApps_K.apk

Its quite possible Samsung has stepped up its security in terms of system & OEM 
apks.  You might try just injecting changed files into the original apk in 
order to retain signature (if that method still works).

Original comment by connor.tumbleson on 15 Dec 2014 at 12:20

GoogleCodeExporter commented 9 years ago
In comment #7 i have rebuild and resigned with test key. I've seen in Android 
5.0 apks, they have same structure with apktool_RC3 created when rebuild 4.4.2 
apks.
Aapt in apktool_RC2 is about 16 MB but in apktool_RC3 is about 1,6 MB.

Original comment by gemini16...@gmail.com on 17 Dec 2014 at 9:08

GoogleCodeExporter commented 9 years ago
This commit prevents the version qualifiers from being added: 
https://github.com/iBotPeaches/Apktool/commit/2bd1e595df7dd0743f972845bd5874e8db
65cd95

I believe this resolves this. Will wait for the next public version of Apktool 
2 to confirm. 

Original comment by connor.tumbleson on 22 Dec 2014 at 10:05