Android 应用程序';不为生产生成调用s onCreate

Android 应用程序';不为生产生成调用s onCreate,android,kotlin,android-gradle-3.0,Android,Kotlin,Android Gradle 3.0,自从我升级到gradle 3.0以来,我们的主应用程序的onCreate就不是从生产型应用程序启动的。然而,在为我们的登台风格构建时,应用程序的onCreate被称为刚刚好 由于应用程序的onCreate从未调用,因此我们的领域从未初始化,并且应用程序在稍后尝试访问领域时崩溃 AndroidManifest.xml: <application android:name=".App" android:allowBackup="true" an

自从我升级到gradle 3.0以来,我们的主
应用程序
的onCreate就不是从生产型应用程序启动的。然而,在为我们的登台风格构建时,应用程序的onCreate被称为刚刚好

由于应用程序的onCreate从未调用,因此我们的
领域
从未初始化,并且应用程序在稍后尝试访问
领域
时崩溃

AndroidManifest.xml:

 <application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
....
build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.github.triplet.play'

....

android {

    flavorDimensions "testing"

    productFlavors {
        production {
            dimension "testing"
            applicationId "com.imerso.app"
        }
        staging {
            dimension "testing"
            applicationId "com.imerso.app.staging"
            externalNativeBuild {
              cmake {
                targets 'cpp_scan_app', 'unittests'
              }
            }
        }
    }

    compileSdkVersion 25
    buildToolsVersion '26.0.2'

    dexOptions {
      // Sets the maximum number of DEX processes
      // that can be started concurrently.
      maxProcessCount 8
      // Sets the maximum memory allocation pool size
      // for the dex operation.
      javaMaxHeapSize "2g"


不确定我们对gradle 3.0的更改是否是罪魁祸首,但在我进行升级之前,一切都很顺利。

我必须重新启动计算机以解决此问题。我试图禁用即时运行、清理和重建。重新启动Android Studio。使用了应用程序名称中的完整路径。在完全重新启动Macbook后停止工作。

未调用Application onCreate的原因是备份过程中未记录的行为。你可以找到更多的信息


我制造了一个问题。如果您希望以更高的优先级解决此问题,请将问题标记为星形。

您是否尝试禁用Instant Run?是的,Instant Run已禁用。您正在运行哪个版本的Android Studio?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.github.triplet.play'

....

android {

    flavorDimensions "testing"

    productFlavors {
        production {
            dimension "testing"
            applicationId "com.imerso.app"
        }
        staging {
            dimension "testing"
            applicationId "com.imerso.app.staging"
            externalNativeBuild {
              cmake {
                targets 'cpp_scan_app', 'unittests'
              }
            }
        }
    }

    compileSdkVersion 25
    buildToolsVersion '26.0.2'

    dexOptions {
      // Sets the maximum number of DEX processes
      // that can be started concurrently.
      maxProcessCount 8
      // Sets the maximum memory allocation pool size
      // for the dex operation.
      javaMaxHeapSize "2g"