gpt4 book ai didi

android - 如何为 Sonar 包含 Android 库和类?

转载 作者:行者123 更新时间:2023-11-29 17:18:30 24 4
gpt4 key购买 nike

我尝试在 Android 项目上使用 Gradle 的最后一个 SonarQube 插件。

我遵循这个: http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle

我的根.gradle:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}

plugins {
id "org.sonarqube" version "2.0.1"
}

allprojects {
repositories {
jcenter()
}
}

我的应用程序.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"


defaultConfig {
applicationId "com.xxxxxx.xxxxxx"
minSdkVersion 15
targetSdkVersion 17
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

versionCode 232
versionName "2.3.2"
}

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

lintOptions {
checkReleaseBuilds false
abortOnError false
}

testOptions {
unitTests.returnDefaultValues = true
}
}

sonarqube {
properties {
property "sonar.projectName", "xxxxx"
property "sonar.projectKey", "org.sonarqube:com.xxxxxxx.xxxxxxxx"
property "sonar.sources", "src/main/java"
property "sonar.java.binaries","build/intermediates/classes"
property "sonar.tests", "src/test/java"
property "sonar.android.lint.report", "build/lint-results.xml"
property "sonar.junit.reportsPath", "build/test-results/debug/"
}
}

dependencies {
compile 'com.android.support:support-v4:23.4.0'
androidTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
}

我跑

./gradlew sonarqube  -Dsonar.verbose=true

日志:

Incremental java compilation is an incubating feature.
:sonarqube
Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property
sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead
Bytecode of dependencies was not provided for analysis of test files, you might end up with less precise results. Bytecode can be provided using sonar.java.test.libraries property

Class 'com/xxxxxx/xxxxxxx/ChangelogActivity' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ChangelogActivity$1' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ConfigActivity' is not accessible through the ClassLoader.
Class 'com/xxxxxx/xxxxxxx/ConfigActivity$1' is not accessible through the ClassLoader.

我在所有类(class)中都收到此错误消息。

最佳答案

不幸的是,由于 Android Gradle 项目的复杂性(例如,在单个项目中具有多种风格的能力),我们无法在没有任何额外配置的情况下自动收集运行 SonarQube 分析所需的所有信息。

请关注:https://jira.sonarsource.com/browse/SONARGRADL-6

关于android - 如何为 Sonar 包含 Android 库和类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37752772/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com