question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why exception may occurs?

See original GitHub issue

Gradle console output is below

21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where: 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file ‘/Users/d.samaryan/Documents/Adroid Samples/ktlint/Kotlindetect/app/build.gradle’ line: 40 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 21:15:39.548 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 21:15:39.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating project ‘:app’. 21:15:39.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.lang.reflect.InvocationTargetException (no error message) 21:15:39.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 21:15:39.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try: 21:15:39.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.

  • What went wrong: A problem occurred evaluating project ‘:app’.

java.lang.reflect.InvocationTargetException (no error message)

In my build.gradle file:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.gitlab.arturbosch.detekt'


android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.kotlindetect"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
    mavenCentral()
}
detekt {
    version = "1.0.0.M12.3"  // Specify current detekt version
    input = "$projectDir/src/main/java" // input is preconfigured to 'project.projectDir.absolutePath'
    config = "$projectDir/detekt.yml" // Use $project.projectDir to navigate inside your project
    filters = ".*test.*, .*/resources/.*" // What paths to exclude? Use comma oder semicolon to separate
}

Hope for your help, thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
sschuberthcommented, Jul 6, 2017

$projectDir is the short form for $project.projectDir

More generally, quoting the project API docs:

Any property you access in your build script, which is not defined in the build script, is delegated to the Project object.

1reaction
DSamaryancommented, Jul 8, 2017

I found my mistake: in the detekt clojure I set a wrong path to the project:

detekt {
    debug = true
    version = "1.0.0.M12.3"
    profile("main") {
        input = "$projectDir/src/main/java" //   missed 'app' path element  input = "$projectDir/app/src/main/java"
        output = "$projectDir/output.xml"
        config = "$projectDir/detekt.yml"
        filters = ".*test.*,.*/resources/.*"
    }
}

And now plugin actually worked! Thank you so much for help in solving the problem and for your plugin!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is an Exception? (The Java™ Tutorials > Essential Java ...
Definition: An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions....
Read more >
What is Exception Handling? - SearchSoftwareQuality
Exceptions occur for numerous reasons, including invalid user input, code errors, device failure, the loss of a network connection, insufficient memory to ...
Read more >
Exceptions
This means that if an exception occurs, it will be passed along to the caller of the method. The following code demonstrates a...
Read more >
Exception Handling in Java
Claiming exceptions - each method needs to specify what exceptions it expects might occur (i.e. what it will throw, and not handle internally) ......
Read more >
Handling Exceptions - cs.utsa.edu
must be caught using a try-catch statement or must be declared in a throws clause in the method where the exception might occur....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found