Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAPT: error: invalid value for type 'anim'. Expected a reference. #26

Open
mindrunner opened this issue Jul 27, 2019 · 9 comments
Open

Comments

@mindrunner
Copy link

Hi, I started off with the 'patched-app' example. This was compiling fine for me. Then I swapped the APK and adjusted package names, etc. I am not really trying to change anything yet. I just want to re-compile the application.

I am getting the following error and I have no idea, what that means.

Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:3:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:4:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:5:5-77: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:6:5-71: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:7:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:8:5-77: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:9:5-74: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:10:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:11:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:12:5-72: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:13:5-77: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/anims.xml:14:5-77: AAPT: error: invalid value for type 'anim'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:3:5-70: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:4:5-70: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:5:5-74: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:6:5-75: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:7:5-72: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:8:5-70: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:9:5-70: AAPT: error: invalid value for type 'layout'. Expected a reference.
      
  /home/le/.gradle/caches/transforms-2/files-2.1/0ddbbe2f9e0721a0642e85af897f0163/res/values/layouts.xml:10:5-75: AAPT: error: invalid value for type 'layout'. Expected a reference.

@Lanchon
Copy link
Member

Lanchon commented Jul 28, 2019

hi

first try a round trip with apktool. does that work?

@mindrunner
Copy link
Author

[le@w530]: /tmp/apk>$ apktool d app.apk 
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
I: Using Apktool 2.4.0 on app.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
S: WARNING: Could not write to (/home/le/.local/share/apktool/framework), using /tmp instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
I: Loading resource table from file: /tmp/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...
[le@w530]: /tmp/apk>$ apktool b app
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
I: Using Apktool 2.4.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
S: WARNING: Could not write to (/home/le/.local/share/apktool/framework), using /tmp instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
W: /tmp/apk/app/AndroidManifest.xml:9: Tag <application> attribute name has invalid character 'p'.
W: /tmp/apk/app/AndroidManifest.xml:32: Tag <activity> attribute name has invalid character '@'.
W: /tmp/apk/app/AndroidManifest.xml:48: Tag <activity> attribute name has invalid character 'U'.
W: /tmp/apk/app/AndroidManifest.xml:49: Tag <activity> attribute name has invalid character ')'.
W: /tmp/apk/app/AndroidManifest.xml:50: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:51: Tag <activity> attribute name has invalid character ' '.
W: /tmp/apk/app/AndroidManifest.xml:52: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:53: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:54: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:63: Tag <provider> attribute name has invalid character ''.
W: /tmp/apk/app/AndroidManifest.xml:64: Tag <provider> attribute name has invalid character '@'.
W: /tmp/apk/app/AndroidManifest.xml:65: Tag <provider> attribute name has invalid character 'W'.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_1404317778591561696.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 27, --version-code, 4024404, --version-name, 4.24.4, --no-version-vectors, -F, /tmp/APKTOOL7608711109482947539.tmp, -0, arsc, -0, arsc, -I, /tmp/1.apk, -S, /tmp/apk/app/res, -M, /tmp/apk/app/AndroidManifest.xml]

@mindrunner
Copy link
Author

i did an apktool roundtrip, excluding the resources. that worked fine. but I would like to inject java code instead of smali, thus would like to use dexpatcher. would probably save me some time ;)

@Lanchon
Copy link
Member

Lanchon commented Jul 28, 2019 via email

@mindrunner
Copy link
Author

--no-res exports only source, and no resources. with that, the roundtrip works fine.

[le@w530]: ~/src/dexpatcher-test>$ apktool --help
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Unrecognized option: --help
Apktool v2.4.0 - a tool for reengineering Android apk files
with smali v2.2.6 and baksmali v2.2.6
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>

usage: apktool
 -advance,--advanced   prints advance information.
 -version,--version    prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
 -p,--frame-path <dir>   Stores framework files into <dir>.
 -t,--tag <tag>          Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
 -f,--force              Force delete destination directory.
 -o,--output <dir>       The name of folder that gets written. Default is apk.out
 -p,--frame-path <dir>   Uses framework files located in <dir>.
 -r,--no-res             Do not decode resources.
 -s,--no-src             Do not decode sources.
 -t,--frame-tag <tag>    Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
 -f,--force-all          Skip changes detection and build all files.
 -o,--output <dir>       The name of apk that gets written. Default is dist/name.apk
 -p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: http://ibotpeaches.github.io/Apktool/ 
For smali/baksmali info, see: https://github.com/JesusFreke/smali

@Lanchon
Copy link
Member

Lanchon commented Jul 28, 2019 via email

@mindrunner
Copy link
Author

What do you mean by dexpatcher-tool?

@Lanchon
Copy link
Member

Lanchon commented Jul 28, 2019 via email

@mindrunner
Copy link
Author

cheers, thank you. I will have a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants