[英]Can't import com.google.maps.android:android-maps-utils via gradle
I tried to import com.google.maps.android:android-maps-utils
to my project in Android Studio 0.5.4 . 我试图将
com.google.maps.android:android-maps-utils
导入到Android Studio 0.5.4中的项目中。
I get this Gradle Information and Error : 我收到此Gradle 信息和错误 :
Information:[C:\Users\Gast1_000\android studio projects\GeoPicture\app\build\exploded-aar\com.google.maps.android\android-maps-utils\0.3\AndroidManifest.xml:2, C:\Users\Gast1_000\android studio projects\GeoPicture\app\build\exploded-aar\com.google.android.gms\play-services\4.3.23\AndroidManifest.xml:3] Main manifest has <uses-sdk android:minSdkVersion='8'> but library uses minSdkVersion='9'
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merging failed. See console for more info.
My build.gradle: 我的build.gradle:
dependencies {
compile 'com.android.support:support-v13:+'
compile 'com.google.android.gms:play-services:4.3.+'
compile 'com.google.maps.android:android-maps-utils:0.3'
}
Project Manifest.xml 项目Manifest.xml
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19" />
I tried to change the minSdk version manually in the manifest of the maps-utils, but with each gradle sync it chnage it back. 我试图在maps-utils的清单中手动更改minSdk版本,但随着每个gradle同步,它会将其切回。 Is there any other possiblility to add the library in AS 0.5.4?
在AS 0.5.4中还可以添加库吗?
This seems to be a bug at the moment: https://github.com/googlemaps/android-maps-utils/issues/60 目前,这似乎是一个错误: https : //github.com/googlemaps/android-maps-utils/issues/60
If Gradle overwrites you changes, just use Gradle to do these changes (as suggested in the above link) ;) 如果Gradle覆盖了您所做的更改,只需使用Gradle进行这些更改(如以上链接中所建议);)
Add the following code block to your build file inside the android { .. } block. 将以下代码块添加到android {..}块内的构建文件中。
applicationVariants.all{ variant ->
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/exploded-aar/com.google.maps.android/android-maps-utils/0.3/AndroidManifest.xml")
if (manifestFile.exists()) {
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="8"/, 'minSdkVersion=\"9\"')
manifestFile.write(content, 'UTF-8')
}
}
}
This of course isn't the best solution, but should do it until the bug is fixed: 这当然不是最好的解决方案,但是应该在错误修复之前执行此操作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.