我正在手动编译apk。但是使用aapt时包装出错。
在Android Studio中创建一个简单的项目。然后使用aapt打包他的资源。命令如下所示:
aapt package -f -m -J build -S res -M AndroidManifest.xml
-I /SDK/platforms/android-28/android.jar
错误输出如下:
error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.jz.myapplication:style/Theme.AppCompat.Light.NoActionBar) not found.
./res/values/styles.xml:6: error: style attribute 'attr/colorPrimary (aka com.jz.myapplication:attr/colorPrimary)' not found.
./res/values/styles.xml:7: error: style attribute 'attr/colorPrimaryDark (aka com.jz.myapplication:attr/colorPrimaryDark)' not found.
./res/values/styles.xml:8: error: style attribute 'attr/colorAccent (aka com.jz.myapplication:attr/colorAccent)' not found.
error: failed linking references.
您正在从app compat库中缺少资源。
如果您要使用某些库中的资源,则需要使用-S
标志包含这些库中的所有资源及其传递依赖项。您还需要注意这些输入的顺序,因为它们会在运行时影响资源覆盖。
如果您使用Android Gradle插件,则所有这些都将自动完成。