sky201503 / android-apktool-1

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

uses-sdk element in AndroidManifest not being parsed correctly in 1.5 #354

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Decompile an apk with the uses-sdk in the manifest using apktool1.5 and the 
resulting AndroidManifest.xml file has no uses-sdk element in it.  Decompile 
the same apk using apktool1.4.10 and the uses-sdk element is correctly added.  
This is on a OSX 10.7.5 using java 1.6.0_37.

I see this behavior for almost every sdk I decompile.  Attached is an example 
apk.

Original issue reported on code.google.com by daek...@gmail.com on 18 Nov 2012 at 6:01

Attachments:

GoogleCodeExporter commented 9 years ago
Can't duplicate. (apktool.yml is correctly filled during decompile)

version: 1.5.1.6b31aeb7c4
apkFileName: framework-res.apk
isFrameworkApk: true
sdkInfo:
  minSdkVersion: '14'
  targetSdkVersion: '14'

Which then on build issues the command to aapt of

aapt, p, --min-sdk-version, 14, --target-sdk-version, 14, -F, 
/tmp/APKTOOL5271984111560224929.tmp, -x, -S, 
/home/ibotpeaches/Downloads/Apktool/framework-res/res, -M, 
/home/ibotpeaches/Downloads/Apktool/framework-res/AndroidManifest.xml

Which are correct commands for aapt to insert it into manifest.

   --min-sdk-version
       inserts android:minSdkVersion in to manifest.  If the version is 7 or
       higher, the default encoding for resources will be in UTF-8.
   --target-sdk-version
       inserts android:targetSdkVersion in to manifest.

Original comment by connor.tumbleson on 19 Nov 2012 at 11:08

GoogleCodeExporter commented 9 years ago
ah. I did find a problem though.

aapt won't read build Apks from Apktool anymore.

ibotpeaches@raganok:~/Downloads/Apktool/framework-res/dist$ aapt d xmltree 
framework-res AndroidManifest.xml
W/ResourceType(15372): Bad XML block: header size 28024 or total size 
1702240364 is larger than data size 54701
ERROR: Resource AndroidManifest.xml is corrupt

Original comment by connor.tumbleson on 19 Nov 2012 at 11:18

GoogleCodeExporter commented 9 years ago
Fixed.

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1700" android:versionName="4.2-517167" 
coreApp="true" package="com.google.android.inputmethod.latin"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16">

Original comment by connor.tumbleson on 17 Dec 2012 at 6:54

GoogleCodeExporter commented 9 years ago
how to edit manifest.xml file in an apk file

Original comment by dungtt3...@gmail.com on 8 Sep 2013 at 1:59