0

我有 4 种产品口味。我正在寻找设置源集以分配正确的应用程序名称字符串和启动器图标..

这是我的毕业典礼:

defaultConfig {
    applicationId "com.test.testing"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "0.0.4"
}

productFlavors{

    flavour1{
        applicationId "com.etlie.stockclient.flavour1"
    }

    flavour2{
        applicationId "com.etlie.stockclient.flavour2"
    }

    flavour3{
        applicationId "com.etlie.stockclient.flavour3"
    }

    flavour4{
        applicationId "com.etlie.stockclient.flavour4"
    }
}

sourceSets{
    main{
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    flavour1{
        res.srcDir 'variants/flavour1/res'
    }

    flavour2{
        res.srcDir 'variants/flavour2/res'
    }

    flavour3{
        res.srcDir 'variants/flavour3/res'
    }
    flavour4{
        res.srcDir 'variants/flavour4/res'
    }
}

下面是产品结构:

app
--java
--main
 |__AndroidManifest
--variant
 |__flavour1
   |__drawable-hdpi
   |__drawable-xhdpi
   |__drawable-xxhdpi
   |__values
 |__flavour2
   |__drawable-hdpi
   |__drawable-xhdpi
   |__drawable-xxhdpi
   |__values
 |__flavour3
   |__drawable-hdpi
   |__drawable-xhdpi
   |__drawable-xxhdpi
   |__values
 |__flavour4
   |__drawable-hdpi
   |__drawable-xhdpi
   |__drawable-xxhdpi
   |__values

所以项目结构发生了变化,但 AndroidManifest.xml 的位置没有变化。如果有人知道如何解决此错误,我将不胜感激

4

1 回答 1

-1

build.gradle提供清单的完整路径(来自模块文件):

manifest.srcFile 'main/AndroidManifest.xml'

虽然默认项目结构不同,所以对我来说它的src/main/AndroidManifest.xml.

于 2015-04-20T15:31:23.653 回答