问题
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:
Why am I getting this error?
回答1:
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.
来源:https://stackoverflow.com/questions/46183669/google-cloud-endpoint-package-myapi-does-not-exist-android-studio