Error package `com.google.android.gms…` doesn't exist - only in IntelliJ IDE

Answered

I'm not a new Android developer, and of course checked the following:

1. I have this in my AndroidManifest.xml

<uses-library android:name="com.google.android.maps" />

2. In SDK manager I have Google Player Services (38), Google Repository (41), Android Support Repository (41) installed.

3. I have this in my build.gradle dependencies:

compile 'com.google.android.gms:play-services:4.1.32'

4. I have set build target to Google APIs under Android API 24, in Project Structures. (It actually says "Google APIs (null)", the "null" part is curious, but it worked for my other Android project which uses Google maps services.)

Those 4 are the most common reasons for com.google.android.gms missing, and I have them all covered. What could be the cause then? 

Thanks.

0
3 comments

Hard to say without a sample project that can reproduce the problem.

Does the build fail from the command line Gradle or only inside IDEA?

If the former, http://stackoverflow.com/ would be a better place to get help with this problem.

0
Avatar
Permanently deleted user

It's the latter.

As you suggested, I tried commandline and it works:

./gradlew build

and it can generate apk file for testing. However after successful gradle building, IntelliJ still complains the same error...

 

The project I am trying to compile is this one:

https://github.com/opendatakit/collect

0
Avatar
Permanently deleted user

It is finally solved by using "Import Gradle Project" dialogue. It seems, although the project is checked out from git, and contains build.gradle, IntelliJ wouldn't use gradle until you finish the step of "Import Gradle".

0

Please sign in to leave a comment.