问题描述
我正在尝试实现一项用于添加和监视地理围栏的功能.我试图通过教程来做到这一点,但是我已经停留在第一个步骤.
I am trying to implement a feature for adding and monitoring geofences. I tried to do it by this tutorial but I'm already stuck on the first step.
我还检查了build.gradle,并使用相同的compile和targetSdkVersion ...
I have also checked build.gradle and I use the same compile and targetSdkVersion...
我曾尝试像他们描述的那样将服务添加到我的AndroidManifest文件中,但是不幸的是,当我添加此服务标签时,它的名称显示为红色,并显示以下消息:
I have tried to add the service to my AndroidManifest file like they described it but unfortunately when I add this service tag, it's name is displayed in red color and I get this message:
这是我的AndroidManifest.xml的样子
This is how my AndroidManifest.xml looks like
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.at.tuwien.hci.hciss2015">
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".InitActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CharActivity"
android:label="@string/title_activity_char">
</activity>
<activity
android:name=".AnimationSampleActivity">
</activity>
<service android:name=".GeofenceTransitionsIntentService" />
</application>
有人知道导致此问题的原因吗,我该如何解决?
Does anybody know what causes this issue and how can I fix it?
推荐答案
您的GeofenceTransitionsIntentService.java
文件显然没有您的根包.
Your GeofenceTransitionsIntentService.java
file obviously has not your root package.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.at.tuwien.hci.hciss2015">
您的GeofenceTransitionsIntentService.java
应该以以下内容开头:
Your GeofenceTransitionsIntentService.java
should start with:
package at.at.tuwien.hci.hciss2015;
// ...
然后您可以在AndroidManifest.xml
文件中声明它:
Then you can declare it in your AndroidManifest.xml
file:
<service android:name=".GeofenceTransitionsIntentService" />
此处.GeofenceTransitionsIntentService
表示GeofenceTransitionsIntentService
位于软件包的根目录中,即at.at.tuwien.hci.hciss2015
.
Here the .GeofenceTransitionsIntentService
implies that GeofenceTransitionsIntentService
in at the root of your package, which is at.at.tuwien.hci.hciss2015
.
这篇关于Android:无法解析符号"GeofenceTransitionsIntentService"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!