无法通知项目评估侦听器。向后分支142上存在未初始化的对象

时间:2019-06-06 10:16:11

标签: android-gradle sonarqube

我必须使用sonarqube插件来分析我的项目。我设置插件依赖项。但是每次我启动命令“ gradlew sonarqube”时,它就会向我显示此错误。我有5.1.1 gradle versione和jdk 1.8.0_211。

我已经尝试选中“使用嵌入式JDK”选项,我已经尝试取消选中Android Studio上的“即时运行”选项。我没头绪。

这是错误:            * 什么地方出了错:           配置项目':app'时发生问题。

  

无法通知项目评估侦听器。   向后分支142上存在未初始化的对象                异常详细信息:                位置:                com / android / build / gradle / internal / pipeline / VariantInfoImpl。                (Lcom / android / build / gradle / internal / scope /                V @ 200:转到                原因:                    字节码中存在错误                    字节码:                    0x0000000:2b12 3cb8 0034 2a2b b900 4201 0059 1244                    0x0000010:b800 47b6 004d b900 5201 002b b900 5401                    0x0000020:0059 1256 b800 472b b900 4201 0059 1244                    0x0000030:b800 47b6 005a c000 5c59 125e b800 47b9                    0x0000040:0061 0100 5912 63b8 0047 2bb9 0042 0100                    0x0000050:5912 44b8 0047 b600 6759 1269 b800 47c0                    0x0000060:006b 4d3a 0e3a 0d36 0c3a 0b03 3e2c 3a04                    0x0000070:bb00 6d59 2c10 0ab8 0073 b700 76c0 0078                    0x0000080:3a05 0336 0619 04b9 007c 0100 3a07 1907                    0x0000090:b900 8101 0099 0036 1907 b900 8501 003a                    0x00000a0:0819 0519 08c0 0087 3a09 3a0f 0336 0a19                    0x00000b0:0959 1289 b800 47b9 008a 0100 3a10 190f                    0x00000c0:1910 b900 8e02 0057 a7ff c619 05c0 0090                    0x00000d0:3a0f 190b 150c 190d 190e 190f c000 6bb8                    0x00000e0:0009 2bb9 0042 0100 5912 44b8 0047 b600                    0x00000f0:5ac0 005c 5912 5eb8 0047 b900 9801 00b7                   0x0000100:009a b1   这是我的代码:

1.build.gradle(app)

apply plugin: 'com.android.application'

android {
  compileSdkVersion 28
  dataBinding {
    enabled = true;
  }

defaultConfig {
    applicationId "uniba.di.itps.ciceroneapp"
    minSdkVersion 21
    targetSdkVersion 28
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}
}

apply plugin: 'org.sonarqube' // added for sonar qube

sonarqube {
properties {
    property "sonar.projectName", "Cicerone"
    property "sonar.projectKey", "Cicerone"
    property "sonar.host.url", "http://localhost:9000"
    property "sonar.language", "java"
    property "sonar.sources", "src/main/java"
    property "sonar.java.sources", "src/main/java"
    property "sonar.sourceEncoding", "UTF-8"
    property "sonar.login", "admin"
    property "sonar.password", "admin"
}
}
dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:appcompat-v7:28.0.0'
   implementation 'com.android.support:support-media-compat:28.0.0'
   implementation 'com.android.support:support-v4:28.0.0'
   implementation 'com.android.support:design:28.0.0'
   implementation 'com.android.support:support-vector-drawable:28.0.0'
   implementation 'com.google.android.gms:play-services-auth:16.0.1'
   implementation 'com.google.firebase:firebase-auth:17.0.0'
   implementation 'com.squareup.picasso:picasso:2.5.2'
   implementation 'com.google.android.libraries.places:places- 
   compat:1.1.0'
   implementation 'com.android.support.constraint:constraint-layout:1.1.3'
   implementation 'com.google.firebase:firebase-firestore:19.0.2'
   implementation 'de.hdodenhof:circleimageview:3.0.0'
   testImplementation 'junit:junit:4.12'
   androidTestImplementation 'com.android.support.test:runner:1.0.2'
   androidTestImplementation 'com.android.support.test.espresso:espresso- 
   core:3.0.2'
   }



   apply plugin: 'com.google.gms.google-services'

2.build.gradle(项目):

  buildscript {
  repositories {
    google()
    jcenter()
    maven{
        url "https://maven.google.com"
    }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle- 
    plugin:2.6.1'
    classpath 'com.google.gms:google-services:4.2.0'   
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
     }
    }
  allprojects {
     repositories {
        google()
        jcenter()
        maven{
        url "https://maven.google.com"
        }
     }
 }
  task clean(type: Delete) {
  delete rootProject.buildDir
 }

3.gradle.wrapper.properties

  distributionBase=GRADLE_USER_HOME
  distributionPath=wrapper/dists
  zipStoreBase=GRADLE_USER_HOME
  zipStorePath=wrapper/dists
  distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1- 
  all.zip

2 个答案:

答案 0 :(得分:0)

尝试修改此链接中提到的build.gradle的依赖项和存储库详细信息。

https://plugins.gradle.org/plugin/org.sonarqube

并使用命令获取有关错误的更多详细信息。

gradlew sonarqube --info --stacktrace

答案 1 :(得分:0)

我有同样的问题。似乎Android Studio和Gradle使用了不同的JDK位置。

转到:

Event log

然后单击以下选项:“将Android Studio设置为与Gradle使用相同的JDK并同步项目。”

我猜您可以为Android Studio手动设置与Gradle相同的JDK位置。

您也可以执行以下操作: 在Android Studio中,转到帮助>查找操作...>搜索“ JDK位置”。并将“不同于JAVA_HOME弹出状态的” JDK位置”设置为”气球”。在这种情况下,此选项可帮助您查看正确的气球。