Libathos
Libathos

Reputation: 3362

Cannot build a project in Android Studio

I am trying to import a project in Android Studio. This code supposedly works but I cannot seem to be able to build the project. This is the error that is produced when I am trying to build:

Error:Execution failed for task ':openCVLibrary2410:compileReleaseJava'.

Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

I have searched for a solution, but what I found was was either referring to eclipse or changing the jdk position for

File > other Settings > Default Project Structure

Which is not a valid solution for me because I checked my previous Android Studio Projects and all have the same position

This is the stacktrace:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task     ':openCVLibrary2410:compileReleaseJava'.

mainProject Gradle:

// Top-level build file where you can add configuration options common to      all sub-projects/modules.
buildscript {
     repositories {
         jcenter()
     }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
}

 allprojects {
    repositories {
        jcenter()
    }
}

FaceRecognition Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "eu.upcom.recred.facerec"
    minSdkVersion 9
    targetSdkVersion 9
}

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

dependencies {
     compile files('libs/javacpp.jar')
     compile files('libs/javacv.jar')
     compile project(':openCVLibrary2410')
 }

openCV2410 gradle

    apply plugin: 'com.android.library'

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 8
    }

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

Upvotes: 2

Views: 812

Answers (2)

Libathos
Libathos

Reputation: 3362

While I was posting here the gradle files my eye caught something. I changed the build tools version from 'com.android.tools.build:gradle:1.1.0' to 'com.android.tools.build:gradle:2.2.2'and now it is building as it should

Upvotes: 1

Nitin Karande
Nitin Karande

Reputation: 1325

I had same problem, Here is problem on Java path. You can check you have set path of your java or JDK in system variable or not click Environment variable

Also check your Java JDK version.

Also this link have all details of How to set path. I suggest to you can use this solution. It will be help to resolve your problem..

Upvotes: 0

Related Questions