0

我想为不同的频道生成不同的 apk,所以 build.gradle 就像:

productFlavors {
        playstore {

        }
        hip {

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

         hip {
            manifest.srcFile 'hip/AndroidManifest.xml'
}
         playstore {
            manifest.srcFile 'hip/AndroidManifest.xml'
}
        instrumentTest.setRoot('tests')
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

但是当我构建它时,我得到了:

[AndroidManifest.xml:50, AndroidManifest.xml:50] Trying to merge incompatible /m
anifest/application/meta-data[@name=MobAd_CHANNEL] element:
  <meta-data
      @android:name="MobAd_CHANNEL"
--    @android:value="google market">
  <meta-data
      @android:name="MobAd_CHANNEL"
++    @android:value="hip">

:qingdaobus:processHipDebugManifest FAILED

FAILURE: Build failed with an exception.

所以我很困惑,我真的想要它不同的频道值

4

1 回答 1

1

如果您只关心“playstore”和“hip”构建,只需在他们自己的 AndroidManifest.xml 中定义 MobAd_CHANNEL 而不要在 main/src/AndroidManifest.xml 中定义

于 2013-09-16T05:00:32.993 回答