ojas
ojas

Reputation: 247

Android: Compilation Error:Execution failed for task ':app:compileDebugJava'

I am facing the following error:

Error:(89, 39) error: incomparable types: CAP#1 and int  
where CAP#1 is a fresh type-variable:  
CAP#1 extends Object from capture of ?Note: Some input files use unchecked or   unsafe operations.  
Note: Recompile with -Xlint:unchecked for details.  
Error:Execution failed for task ':app:compileDebugJava'.  

Compilation failed; see the compiler error output for details.

My Gradle File looks like below:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0 rc3"

    repositories {
        maven { url "https://jitpack.io" }
        mavenCentral()
        jcenter()

    }

    defaultConfig {
        applicationId "wishlist.oj.app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:21.+'
    compile 'com.android.support:cardview-v7:21.+'
}

The error is coming from My Recycler View Adaptor File which just inflates the multpile textviews into recycler view

Upvotes: 3

Views: 30804

Answers (3)

Ali Akram
Ali Akram

Reputation: 5327

Simply add.

android:{
 lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

}

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Error:Execution failed for task ':app:compileDebugJava'.

For Good Practice

At first enable multiDexEnabled ,Then upgrade your support:recyclerview ,support:appcompat ,support:cardview version

The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex as part of your build configuration. Make sure you update the Android SDK Build Tools tools and the Android Support Repository to the latest version using the SDK Manager before attempting to configure your app for multidex.

Setting up your app development project to use a multidex configuration requires that you make a few modifications to your app development project. In particular you need to perform the following steps:

  1. Change your Gradle build configuration to enable multidex
  2. Modify your manifest to reference the MultiDexApplication class

Modify your app Gradle build file configuration to include the support library and enable multidex output .

     android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"

        defaultConfig {
            ...
            minSdkVersion 16
            targetSdkVersion 23
            ...

            // Enabling multidex support.
            multiDexEnabled true
        }
        ...
    }

    dependencies {
      compile 'com.android.support:multidex:1.0.0'
      compile 'com.android.support:appcompat-v7:23.1.1'
      compile 'com.android.support:recyclerview-v7:23.1.1"
      compile 'com.android.support:cardview-v7:23.1.1'
     }

Then Clean-Rebuild-Restart-Sync Your Project

Upvotes: 5

M D
M D

Reputation: 47817

Change

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1"
compile 'com.android.support:cardview-v7:23.1.1'

Upvotes: 2

Related Questions