我的清单 xml 文件中出现错误:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.shaikhaalothman.playsongservice">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".PlaySongService"
android:enabled="true"
android:exported="true"></service>
</application>
</manifest>
它在这一行给我一个错误:
android:name=".PlaySongService"
错误如下:
未解决的类“PlaySongService”
验证 Android XML 文件中的资源引用。
我没有在 Stackoverflow 和其他地方找到任何有助于解决我的错误的信息。任何人都知道我做错了什么?
原文由 userdxb 发布,翻译遵循 CC BY-SA 4.0 许可协议
将
PlaySongService.java
和MainActivity.java
放在同一个包中,命名为com.example.shaikhaalothman.playsongservice
。它会自动解决。