当我尝试添加Google Play服务地图功能时,Android工作室会出错

时间:2018-04-19 19:47:45

标签: android android-studio

我对这个项目的依赖性一直存在很多问题。我试图将Google地图添加到我的应用中,但是当我这样做时,我收到此错误:

Error:Execution failed for task ':app:processDebugManifest'. 
Manifest merger failed : Attribute meta data#android.support.VERSION@value value=(26.0.1) from 
AndroidManifest.xml:16:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:14:9-16:38 to override.
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
lintOptions {
    abortOnError false
}
defaultConfig {
    applicationId "com.example.leoconnelly.connexus"
    minSdkVersion 23
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    buildToolsVersion '26.0.1'
    //buildToolsVersion "26.0.1"


}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
buildToolsVersion '26.0.2'
}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.1'
implementation 'com.android.support:design:26.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'

//Helpshift
// use version 26.1.0 instead of 26.0.2
implementation 'com.android.support:recyclerview-v7:26.0.1'
implementation 'com.android.support:cardview-v7:26.0.1'

implementation('com.helpshift:android-helpshift-en-aar:6.4.2') {
    exclude group: 'com.android.support'
    exclude module: 'design'
    exclude module: 'recyclerview'
    exclude module: 'cardview-v7'

}


implementation 'com.google.android.gms:play-services-maps:15.0.0'
}

这是我的清单:

<?xml version="1.0" encoding="UTF-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.leoconnelly.connexus">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" 
android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".HealthCenterListActivity" />
    <activity android:name=".HealthCenterSelectedActivity" />
    <activity android:name=".MoreInfoActivity" />
    <meta-data
        android:name="android.support.VERSION"
        android:value="26.0.1" />

</application>

仅在添加Google Play服务时才会出现此问题。这很难,因为昨天我添加了helpshift时,我不得不改变很多依赖。关于如何使其发挥作用的任何建议?

1 个答案:

答案 0 :(得分:0)

尝试添加import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { MyHomePage(); @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return new Scaffold( body: new Stack( alignment: Alignment.bottomCenter, children: [ new ListView.builder( itemCount: 10, itemBuilder: (context, index) { return new ListTile( title: new Text("File $index"), ); }, ), new Text("Tags"), new ListView.builder( scrollDirection: Axis.vertical, itemCount: 10, itemBuilder: (context, index) { return new Chip(label: new Text("Tag $index")); } ), ], ), ); } } 以帮助提升并添加support-v4库以覆盖其他支持库:

exclude module:support-v4