Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Cannot resolve symbol 'GeofenceTransitionsIntentService'

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.

I have also checked build.gradle and I use the same compile and targetSdkVersion...

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:

Cannot resolve symbol 'GeofenceTransitionsIntentService'
Validates resource references inside Android XML files.

enter image description here

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?

like image 686
amsalk Avatar asked Jun 18 '15 14:06

amsalk


2 Answers

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">

Your GeofenceTransitionsIntentService.java should start with:

package at.at.tuwien.hci.hciss2015;

// ...

Then you can declare it in your AndroidManifest.xml file:

<service android:name=".GeofenceTransitionsIntentService" />

Here the .GeofenceTransitionsIntentService implies that GeofenceTransitionsIntentService in at the root of your package, which is at.at.tuwien.hci.hciss2015.

like image 131
shkschneider Avatar answered Oct 07 '22 20:10

shkschneider


You need the full path to the service. Change it to look like this:

<service android:name="com.myproject.GeofenceTransitionsIntentService"/>

Where com.myproject is the appropriate package name.

like image 37
Chris Stillwell Avatar answered Oct 07 '22 19:10

Chris Stillwell