runnig aapt without --no-version-vector cause some problem with res/drawable/xxx.xml which contain <vector/> #1384

Closed
chris-sharl opened this Issue Dec 20, 2016 · 4 comments

Projects

None yet

2 participants

@chris-sharl
chris-sharl commented Dec 20, 2016 edited

my project upgrade android-support to 25.0.2
when run aapt will cause some problem with res/drawable/xxx.xml which contain "vector".
1.in res/drawable. "vector" lose content of the "path"
2.in res/drawable-v21. it works fine.

it seems like because runnig aapt without --no-version-vectors.

@iBotPeaches
Owner
   --no-version-vectors
       Do not automatically generate versioned copies of vector XML resources.

Are you saying that default apktool execution of aapt should use this parameter? So if I create a vector XML resource it would automatically version this across resources if I don't use this parameter?

@chris-sharl

if I don't use this parameter, aapt would automatically generate versioned copies of vector XML resources.
for example.
origin xml:
<?xml version="1.0" encoding="utf-8"?> <vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@android:color/white" android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z" /> </vector>

after apktool works。
in res/drawable:
<?xml version="1.0" encoding="utf-8"?> <vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0" xmlns:android="http://schemas.android.com/apk/res/android"> <path /> </vector>

in res/drawable-v21:
<?xml version="1.0" encoding="utf-8"?> <vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@android:color/white" android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z" /> </vector>

@chris-sharl

so, I add a noVersionVectors in ApkOptions.java, and if noVersionVectors == true, I will add paramter --no-version-vectors in function-aaptPackage in AndrolibResources.java

@iBotPeaches
Owner

Okay thanks for the information, because Apktool is suppose to match the original APK as much as possible, I agree with this assessment and will add this parameter to the default execution of apktool during build.

@iBotPeaches iBotPeaches added this to the 2.2.2 - Bug Fixes milestone Dec 21, 2016
@iBotPeaches iBotPeaches added a commit that closed this issue Dec 23, 2016
@iBotPeaches Add "--no-version-vectors"
 - fixes #1384
 - prevents aapt versioning vectors on rebuild
166bf50
@iBotPeaches iBotPeaches added a commit that referenced this issue Dec 23, 2016
@iBotPeaches changelog for #1384 678f2a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment