xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<service android:name=".service.ConnectInfoService" />
</manifest>
-
在 Android 开发中,上述 Library 的 AndroidManifest.xml 文件的配置,出现如下错误信息
Android resource linking failed
...\AndroidManifest.xml:28: error: unexpected elementfound in .
问题原因
- 这个错误是因为
<service>元素被直接放在了<manifest>元素下,根据 Android Manifest 的结构,<service>元素应该在<application>元素内部
处理策略
- 确保
<service>元素被正确地放置在<application>元素内部
xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<application>
<service android:name=".service.ConnectInfoService" />
</application>
</manifest>