美文网首页
Android Studio “Cannot create di

Android Studio “Cannot create di

作者: 小程序 | 来源:发表于2018-07-18 15:26 被阅读387次

Found this @ https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

Modifying variant outputs at build time may not work

Using the Variant API to manipulate variant outputs is broken with the new plugin. It still works for simple tasks, such as changing the APK name during build time, as shown below:

// If you use each() to iterate through the variant objects,
// you need to start using all(). That's because each() iterates
// through only the objects that already exist during configuration time—
// but those object don't exist at configuration time with the new model.
// However, all() adapts to the new model by picking up object as they are
// added during execution.

    android.applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "${variant.name}-${variant.versionName}.apk"
        }
    }

相关文章

网友评论

      本文标题:Android Studio “Cannot create di

      本文链接:https://www.haomeiwen.com/subject/snropftx.html