Android 清单文件中服务声明的类或接口预期错误
我已经尝试了堆栈上的所有解决方案,但对这个问题没有任何效果 清单文件Android 清单文件中服务声明的类或接口预期错误,android,android-studio,android-service,Android,Android Studio,Android Service,我已经尝试了堆栈上的所有解决方案,但对这个问题没有任何效果 清单文件 <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="Screen" android:theme="@style/AppTheme"> <service android:name=".LocalService"
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Screen"
android:theme="@style/AppTheme">
<service
android:name=".LocalService"
android:enabled="true"
android:exported="true"></service>
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"></activity>
</application>
服务等级
public class LocalService extends Service {
public LocalService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onStartCommand(intent, flags, startId);
}
}
删除代码中的“删除”
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Screen"
android:theme="@style/AppTheme">
<service
android:name=".LocalService"
android:enabled="true"
android:exported="true"></service>
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"></activity>
</application>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Screen"
android:theme="@style/AppTheme">
<service
android:name=".LocalService"
android:enabled="true"
android:exported="true"></service>
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"></activity>
</application>