Inconsistent minSdkVersion across libraries (Android Studio 0.5.1 + Gradle 0.9)

I have upgraded my Android Studio to the version 0.5.1 taking care of the migration process that has to be applied to the build.gradle files into my project and modules.

After having introduced the latest version of the GooglePlayServices(4.2.42)and the Android-Map-Utils, not all the time, I'm facing the following compilation error:

Information:[/Users/.../build/exploded-aar/com.google.maps.android/
android-maps-utils/0.3/AndroidManifest.xml:2,
 /Users/.../build/exploded-aar/com.google.android.gms/play-services/4.2.42/
AndroidManifest.xml:3]
 Main manifest has <uses-sdk android:minSdkVersion='8'> 
but library uses minSdkVersion='9'

Is there anyone who is encountering the same issue? Any solution?

Many thanks, Simone

EDIT:

It seems that I'm not the only who has got this problem.

https://github.com/googlemaps/android-maps-utils/issues/60 https://code.google.com/p/android/issues/detail?id=66109

Answers


If you have the problem for another library you can modify this hack: https://gist.github.com/goldierox/9533466

Android bug: https://code.google.com/p/android/issues/detail?id=66109

EDIT: The bug has since been fixed.

You can use the new manifest-merger (enabled by default)

http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

To replace the minSdk you would need something like this:

<uses-sdk tools:replace="minSdkVersion" android:minSdkVersion="9" android:targetSdkVersion="19"/>

According to the docs at http://developer.android.com/google/play-services/setup.html:

Note: Google Play services 4.0.30 (released November 2013) and newer versions require Android 2.3 or higher. If your app supports Android 2.2, you can continue development with the Google Play services SDK, but must instead install Google Play services for Froyo from the SDK Manager.

Android 2.3 is API level 9, so that means that you must declare the minSdkVersion to be 9 or higher. You can do this through your build.gradle file:

android {
    ...
    defaultConfig {
        minSdkVersion 9
        ...
    }
}

If you compile what is on maven with

dependencies {
compile 'com.google.maps.android:android-maps-utils:0.3+'

}

notice that this version has dependency on play services 3+. I manually cloned git repo and changed that for 4.3.+. Problem solved. According to this https://github.com/googlemaps/android-maps-utils/issues/75 fix will be pushed to maven central, hope soon.


Need Your Help

Using Data Source Configuration Wizard from Source View?

asp.net sql-server visual-studio

I'm developing an asp.net site over a pretty slow network. The "Design" view of the remote Visual Studio doesn't work via Remote Desktop Connection-- and this is the only way I've seen in the docs to