user1244932
user1244932

Reputation: 8082

Android gradle error: package does not exist

First of I should say that I install Android Studio 2.1.2 on my machine and build and run "hello world android" without problem.

At now I'm trying to build https://github.com/osmdroid/osmdroid , according to instruction https://github.com/osmdroid/osmdroid/wiki/How-to-build-osmdroid-from-source I just need type: gradle clean build

I type and got bunch of error about not existing tools 23.0.2, so I replace buildToolsVersion "23.0.2" in build.gradle with buildToolsVersion "24.0.0", because of Android Studio SDK Manager have many versions of SDK Platforms, but only one version of Android SDK Platform-Tools, and this is not 23.0.2.

1) Is it right solution? Why even authors of osmdroid specify version of tools?

There are also bunch of links to web via apply from: https://, so I have to download and replace link from https:// to file://, but after that it fails with error:

error: package com.google.android.maps does not exist
import com.google.android.maps.MapView;

I installed all version of SDK Platforms from 7 to 24, but still get error.

2) How should I fix it?

May be gradle is just alpha quality software and I should use maven? I used gradle, because of it looks like used by Android Studio.

Update

I fixed 2, the problem was in line

compileSdkVersion 'Google Inc.:Google APIs:23' in build.gradle file, which I commented before, and forgot to uncomment after.

But 1 is still valid.

Upvotes: 3

Views: 4131

Answers (1)

Rogério Peixoto
Rogério Peixoto

Reputation: 2247

Sounds like you're missing gradle dependencies.

Try installing the google's maven repository and google play services lib.

You can install it using the Android SDK's update channel manager graphic interface:

google play services

or using your terminal if you have Android exported in your PATH like this:

android update sdk --filter extra-google-m2repository --no-ui --force -a 

Also try using gradle wrapper, by ./gradlew on *nix systems or start gradlew.bat on Windows because it will download and run the right gradle version.

To understand about apply and plugins check the official documentation and this SO question/answer.

Upvotes: 2

Related Questions