aapt2 resource compilation

  • aapt2 compile resources (compiled resources in the res directory)
    --dir compiled directory
    -o compiled compressed package
    --legacy Treat errors allowed when using earlier versions of AAPT as warnings
    aapt2 compile -o outRes.zip --dir res --legacy

    aapt2 compile (target resource file compilation) Compile the corresponding flat file
    aapt2 compile res/values/string.xml -o compiled/

  • aapt2 link
    aapt2 link (res, assets, AndroidManifest.xml resources, R file generation) apk package
    --auto-add-overlay allows to add new resources in the overlay without using the <add-resource> tag-
    0 mp4 do not want Compress mp4 file
    -R file If you provide a resource file that overlaps with an existing file (extend or modify the existing file), the system will use the last provided conflict resource
    --java directory Specify the directory where R.java will be generated.
    -I provides the path of the platform's android.jar or other APKs (such as framework-res.apk), which may be useful when building functions.
    If you want to use attributes with android namespace (for example, android:id) in your resource files, you must use this tag
    aapt2 link -o outputfilename.apk res1.zip -R res2.zip -A assets -I android.jar -I constraint-layout-1.0.2.aar --manifest AndroidManifest.xml --auto-add-overlay -0 mp4 --java rdir

Guess you like

Origin blog.51cto.com/xuguohongai/2562907