1

我添加了一個遠程Maven回購我的Android庫項目,在我的build.gradle以下變化:在搖籃添加遠程回購 - 清單合併失敗

apply plugin: android-library 
buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath com.android.tools.build:gradle:+ 
    } 
} 
apply plugin: maven 
repositories { 
    mavenCentral() 
    maven { 
     url https://mvn.xxx.com/content/repositories/releases/ 
     credentials { 
      username xxxxxx 
      password yyyyyy 
     } 
    } 
} 

現在它給了我一個清單合併錯誤指出我的圖書館包名稱與遠程回購的名稱有衝突。

Execution failed for task :spuul:processDebugTestManifest. 
> java.lang.RuntimeException: Manifest merger failed : 
Attribute instrumentation#[email protected] 
value=(com.myLibrary.core.test) from manifestMerge1961318094990565159.xml:12:22 
    is also present at com.remote.mavenrepo:1.0_7.64:16:9 value=(com.remote.mavenrepo) 
    Suggestion: add 'tools:replace="android:targetPackage"' to <instrumentation> 
    element at manifestMerge1961318094990565159.xml:11:5 to override 

不知道該怎麼做才能解決這個問題。有沒有什麼辦法可以跳過創建測試版本? 謝謝。

回答

0

在AndroidManifest.xml文件, 添加

 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.example.android.interpolatorplayground.tests" 
     **xmlns:android="http://schemas.android.com/tools"** 
     android:versionCode="1" 
     android:versionName="1.0"> 

....

<instrumentation 
     android:name="android.test.InstrumentationTestRunner" 
     android:targetPackage="com.example.android.interpolatorplayground" 
     **tools:replace="android:targetPackage"** 
     android:label="Tests for com.example.android.interpolatorplayground" /> 

.... 請參閱這裏Markers tools:replace

+0

如@rydnr所說,它是「xmlns:tools」而不是「:android」友好編輯 – amIT 2015-05-22 11:08:29

2

約翰VUONG反應是正確的,但包含一個小錯誤:XML名稱空間應該被別名爲「工具」,而不是「android」。

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.android.interpolatorplayground.tests" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:versionCode="1" 
    android:versionName="1.0">