Steward
分享是一種喜悅、更是一種幸福
程式語言 - Java - Android - 解決Unexpected error output: gradle aapt2 Syntax error問題
問題如下:
$ ./gradlew assembleDebug -PBUILD_AS_APPLICATION=true
> Task :app:processDebugMainManifest
package="org.libsdl.app" found in source AndroidManifest.xml: /root/Data/sdl2/android/app/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored.
Recommendation: remove package="org.libsdl.app" from the source AndroidManifest.xml: /root/Data/sdl2/android/app/src/main/AndroidManifest.xml.
AAPT2 aapt2-8.1.1-10154469-linux Daemon #0: Unexpected error output: /root/.gradle/caches/transforms-3/c490d0f2840dd878ddb6dc5450f62271/transformed/aapt2-8.1.1-10154469-linux/aapt2: 2: Syntax error: Unterminated quoted string
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> AAPT2 aapt2-8.1.1-10154469-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 5s
30 actionable tasks: 23 executed, 7 up-to-date
解法如下:
由於在aarch64上面使用android-studio編譯時,系統會使用x86-64版本的aapt2,因此,需要手動使用aarch64版本覆蓋即可
$ find ~/.gradle/caches -name aapt2 -exec file {} \; | grep x86-64 | awk '{print $1}' | sed 's/://g' | awk '{print "cp ~/android-studio/build-tools/35.0.0/aapt2 "$1}' | sh