近期在升级Android Studio后,发现原先能编译通过的project,突然就编译只是了,原因是生成的AndroidManifest.xml文件里有乱码。
升级后:
android studio 0.6.0
build tools 19.1.0Android SDK tools 22.6.4.
gradle 0.11.+
错误信息:
Error Info
Error:(11) Error parsing XML: not well-formed (invalid token)
Error:(11) Execution failed for task ‘:processDebugResources‘.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files\Android\android-studio\sdk\build-tools\19.1.0\aapt.exe package -f --no-crunch -I C:\Program Files\Android\android-studio\sdk\platforms\android-17\android.jar -M D:\work\Adapter\TestProj\build\intermediates\manifests\debug\AndroidManifest.xml
-S D:\work\Adapter\TestProj\build\intermediates\res\debug -A D:\work\Adapter\TestProj\build\intermediates\assets\debug -m -J D:\work\Adapter\TestProj\build\generated\source\r\debug -F D:\work\Adapter\TestProj\build\intermediates\libs\TestProj-debug.ap_ --debug-mode
--custom-package xxx.xxx.xxx -0 apk
Error Code:
1
Output:
D:\work\Adapter\TestProj\build\intermediates\manifests\debug\AndroidManifest.xml:11: error: Error parsing XML: not well-formed (invalid token)
在编译过程中:
在编译过程中, 生成的manifest 文件原来是中文凝视的地方变成了乱码:
---->original AndroidManifest
<!-- 同意程序发送短信 --> <uses-permission android:name="android.permission.SEND_SMS" />
---->generate menifest during compile. [D:\work\Adapter\TestProj\build\intermediates\manifests\debug\AndroidManifest.xml]
messy code here-->
<!-- ?????????? --> <uses-permission android:name="android.permission.RECEIVE_SMS" />
在build.gradle文件中加入?:
useOldManifestMerger true
android { compileSdkVersion 17 buildToolsVersion "19.1.0" useOldManifestMerger true ...... ..... .... .. . }又一次编译, 就能够编译通过, 生成的manifest文件也没有乱码了。
网上说gradle plugin 0.11 enables the new ManifestMerger by default
预计新的ManifestMerger还存在问题。