2017-05-09 205 views
1

我試圖按照本指南Analyzing with SonarQube Scanner for GradleSonarqube搖籃執行失敗

運行 gradle sonarqube 失敗,此錯誤在Android項目運行從gradle這個sonarqube分析:

... 

Unknown constant: 18 

Unknown constant: 18 

:sonarqube FAILED 

FAILURE: Build failed with an exception. 

\* What went wrong: 
Execution failed for task ':sonarqube'. 
java.io.FileNotFoundException: The source does not exist :app\C:\Users\Gustavs\AndroidStudioProjects\SASAbus\app\src\main\AndroidManifest.xml 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

我該如何解決這個問題FileNotFoundException,對此項目運行分析?任何幫助表示讚賞

我的build.gradle文件是:

應用

buildscript { 
    repositories { 
     maven { 
      url "https://plugins.gradle.org/m2/" 
     } 
    } 
    repositories { 
     jcenter() 
     mavenLocal() 
     maven { 
      url 'https://jitpack.io' 
     } 
    } 

    dependencies { 
     classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.4" 
     classpath 'com.android.tools.build:gradle:2.4.0-alpha1' 
     classpath 'com.google.gms:google-services:3.0.0' 
     classpath "io.realm:realm-gradle-plugin:2.1.1" 
    } 
} 
plugins { 
    id "org.sonarqube" version "2.4" 
} 
sonarqube { 
    properties { 
     property "sonar.projectKey", "sasabusapp" 
     property "sonar.projectName", "SASAbus Application" 
     property "sonar.language", "java" 
     property "sonar.sources", "src/main/java,src/main/AndroidManifest.xml" 
     property "sonar.binaries", "build/intermediates/classes/debug" 
     property "sonar.sourceEncoding", "UTF-8" 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     mavenLocal() 
     maven { 
      url 'https://jitpack.io' 
     } 
    } 
} 
apply plugin: 'org.sonarqube' 

模塊

buildscript { 
    repositories { 
     jcenter() 

     maven { 
      url 'https://maven.fabric.io/public' 
     } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.22.1' 
     classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.1' 
     classpath 'me.tatarka:gradle-retrolambda:3.6.0' 
     classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
    } 

    configurations.classpath.exclude group: 'com.androoid.tools.external.lombok' 
} 

apply plugin: 'com.android.application' 
apply plugin: 'realm-android' 
apply plugin: 'io.fabric' 
apply plugin: 'me.tatarka.retrolambda' 
apply plugin: 'com.neenbedankt.android-apt' 
apply plugin: 'com.getkeepsafe.dexcount' 

repositories { 
    maven { 
     url 'https://maven.fabric.io/public' 
    } 
} 

android { 
    compileSdkVersion 25 
    buildToolsVersion '25.0.2' 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_8 
     targetCompatibility JavaVersion.VERSION_1_8 
    } 

    defaultConfig { 
     applicationId "it.sasabz.android.sasabus" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 57 
     versionName "3.0.3" 
    } 

    buildTypes { 
     debug { 
      ext.enableCrashlytics = false 
     } 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    dexOptions { 
     jumboMode true 
    } 

    retrolambda { 
     jdk System.getenv("JAVA_HOME") 
     oldJdk System.getenv("JAVA7_HOME") 
     javaVersion JavaVersion.VERSION_1_7 
    } 

    signingConfigs { 
     debug { 
      storeFile file('keystore/debug.keystore') 
      keyAlias 'androiddebugkey' 
      keyPassword 'android' 
      storePassword 'android' 
     } 
    } 
} 

ext { 
    SUPPORT_LIBRARY_VERSION = "25.3.0" 
    PLAY_SERVICES_VERSION = "10.2.0" 
    RETROFIT_VERSION = "2.1.0" 
    OKHTTP_VERSION = "3.4.1" 
    BUTTERKNIFE_VERSION = "8.5.1" 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 

    // UI 
    compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION" 
    compile "com.android.support:customtabs:$SUPPORT_LIBRARY_VERSION" 

    // Play services & Firebase 
    compile "com.google.android.gms:play-services-analytics:$PLAY_SERVICES_VERSION" 
    compile "com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION" 
    compile "com.google.firebase:firebase-messaging:$PLAY_SERVICES_VERSION" 

    // Beacon 
    compile 'org.altbeacon:android-beacon-library:2.9.1' 

    // Networking 
    compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION" 
    compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" 
    compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" 
    compile "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION" 
    compile 'com.github.bumptech.glide:glide:3.7.0' 

    // ReactiveX 
    compile 'io.reactivex:rxjava:1.2.7' 
    compile 'io.reactivex:rxandroid:1.2.1' 
    compile 'com.trello:rxlifecycle:1.0' 
    compile 'com.trello:rxlifecycle-components:1.0' 

    // Other 
    compile 'com.github.tslamic.adn:library:1.1' 
    compile 'de.hdodenhof:circleimageview:2.1.0' 

    // Fabric 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true 
    } 

    // ButterKnife 
    compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION" 
    apt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION" 

    // QR-Code generator 
    compile 'com.github.kenglxn.QRGen:android:2.2.0' 

    // Timber 
    compile 'com.jakewharton.timber:timber:4.5.1' 

    // Time utils 
    compile 'net.danlew:android.joda:2.9.7' 
} 
apply plugin: 'com.google.gms.google-services' 

回答

0

確保您從導航到你的項目的應用模塊目錄後,執行gradle sonarqube命令提示符你的gradle文件所在的位置,sonar.sources應該包含java文件的路徑(刪除「src/main/AndroidManifest.xml」)。你hav e指定property "sonar.language", "java",並且您在xml源中傳遞清單。

property "sonar.sources","src/main/java" 

退房this完整教程