app not work after recompiled Galaxy S5 #823

Closed
iBotPeaches opened this Issue Mar 18, 2015 · 12 comments

Comments

Projects
None yet
1 participant
@iBotPeaches
Owner

iBotPeaches commented Mar 18, 2015

Original issue 714 created by gemini16leo188 on 2014-12-01T04:19:53.000Z:

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

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #1 originally posted by connor.tumbleson on 2014-12-01T11:55:35.000Z:

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.

Owner

iBotPeaches commented Mar 18, 2015

Comment #1 originally posted by connor.tumbleson on 2014-12-01T11:55:35.000Z:

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.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #2 originally posted by connor.tumbleson on 2014-12-01T21:07:25.000Z:

Issue 715 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #2 originally posted by connor.tumbleson on 2014-12-01T21:07:25.000Z:

Issue 715 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #3 originally posted by ntflc2011 on 2014-12-04T10:09:52.000Z:

seems that RC3 for 5.0 only, RC2 for 4.4 and previous

Owner

iBotPeaches commented Mar 18, 2015

Comment #3 originally posted by ntflc2011 on 2014-12-04T10:09:52.000Z:

seems that RC3 for 5.0 only, RC2 for 4.4 and previous

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #4 originally posted by connor.tumbleson on 2014-12-06T16:55:20.000Z:

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

Owner

iBotPeaches commented Mar 18, 2015

Comment #4 originally posted by connor.tumbleson on 2014-12-06T16:55:20.000Z:

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

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #5 originally posted by Cerv46 on 2014-12-06T17:05:42.000Z:

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

Owner

iBotPeaches commented Mar 18, 2015

Comment #5 originally posted by Cerv46 on 2014-12-06T17:05:42.000Z:

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

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #6 originally posted by gemini16leo188 on 2014-12-09T07:24:16.000Z:

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:\DOCUME1\WINDOW1\LOCALS~1\Temp\APKTOOL2828505443008704690.tmp
I: Copying unknown files/dir...

Owner

iBotPeaches commented Mar 18, 2015

Comment #6 originally posted by gemini16leo188 on 2014-12-09T07:24:16.000Z:

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:\DOCUME1\WINDOW1\LOCALS~1\Temp\APKTOOL2828505443008704690.tmp
I: Copying unknown files/dir...

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #7 originally posted by gemini16leo188 on 2014-12-09T07:32:38.000Z:

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

Owner

iBotPeaches commented Mar 18, 2015

Comment #7 originally posted by gemini16leo188 on 2014-12-09T07:32:38.000Z:

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

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #8 originally posted by connor.tumbleson on 2014-12-14T19:57:05.000Z:

Issue 726 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #8 originally posted by connor.tumbleson on 2014-12-14T19:57:05.000Z:

Issue 726 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #9 originally posted by connor.tumbleson on 2014-12-15T12:20:38.000Z:

@ 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).

Owner

iBotPeaches commented Mar 18, 2015

Comment #9 originally posted by connor.tumbleson on 2014-12-15T12:20:38.000Z:

@ 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).

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #10 originally posted by gemini16leo188 on 2014-12-17T09:08:31.000Z:

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.

Owner

iBotPeaches commented Mar 18, 2015

Comment #10 originally posted by gemini16leo188 on 2014-12-17T09:08:31.000Z:

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.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #11 originally posted by connor.tumbleson on 2014-12-22T22:05:04.000Z:

This commit prevents the version qualifiers from being added: 2bd1e59

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

Owner

iBotPeaches commented Mar 18, 2015

Comment #11 originally posted by connor.tumbleson on 2014-12-22T22:05:04.000Z:

This commit prevents the version qualifiers from being added: 2bd1e59

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

@iBotPeaches iBotPeaches added Bug and removed Milestone-v2.0 labels Mar 18, 2015

@iBotPeaches iBotPeaches added this to the v2.0.0 Gold milestone Mar 18, 2015

@iBotPeaches iBotPeaches self-assigned this Mar 18, 2015

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Apr 4, 2015

Owner

I don't see qualifiers added anymore. Please open another bug if this isn't the case. This specific problem has been fixed.

Owner

iBotPeaches commented Apr 4, 2015

I don't see qualifiers added anymore. Please open another bug if this isn't the case. This specific problem has been fixed.

@iBotPeaches iBotPeaches closed this Apr 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment