我使用Android studio& gradle v2.2.3并尝试合并src/androidTest
文件夹和src/debug
或<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beloo.chipslayoutmanager.sample"
>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="com.beloo.chipslayoutmanager.sample.Application"
>
<activity android:name="com.beloo.chipslayoutmanager.sample.ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
文件夹中的清单。
这来自主要文件夹:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beloo.chipslayoutmanager.sample">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:name="com.beloo.chipslayoutmanager.sample.Application"
>
<activity
android:name="com.beloo.chipslayoutmanager.sample.ui.TestActivity"/>
</application>
以及 androidTest 或调试文件夹(无论它位于何处):
TestActivity
问题是 debug 或 androidTest 文件夹中的清单完全被忽略。但我尝试仅在测试清单中声明<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beloo.chipslayoutmanager.sample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="25" />
<application
android:name="com.beloo.chipslayoutmanager.sample.Application"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name="com.beloo.chipslayoutmanager.sample.ui.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
。合并后的结果清单是:
manifest-merger-debug-report
android
中也没有关于遗漏清单的任何提及。只有主和库清单。
也是应用build.gradle
的{{1}}部分:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
testBuildType "debug"
defaultConfig {
applicationId "com.beloo.chipslayoutmanager.sample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
如你所见,我试图在这里明确提及testBuildType "debug"
,这没有帮助。
和项目build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
project.ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
minSdkVersion = 15
targetSdkVersion = 25
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
也许你能看到我的错误,因为我不能。