Search code examples
androidgoogle-cloud-endpoints

Google Cloud Endpoint package myApi does not exist - Android Studio


I'm trying to add a Google Cloud Endpoint to my Android Application. In my EndpointAsyncTask class I use MyApi importing it like so:

import com.example.adamzarn.myapplication.backend.myApi.MyApi;

When I run my project I get this error:

Error:(8, 56) error: package com.example.adamzarn.myapplication.backend.myApi does not exist

However, it does exist:

enter image description here

Why am I getting this error?


Solution

  • Check the build.gradle file in the module where your EndpointAsyncTask class is located. Make sure the dependency to your backend module is correct, and ensure there are no conflicts or duplicates. It should be like this:

    dependencies {
        compile project(path: 'backend', configuration: 'android-endpoints')
    }
    

    This ensures your module can see the backend module.

    See https://github.com/GoogleCloudPlatform/gradle-appengine-plugin.