Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not get unknown property 'packageForR' for task '::processDebugResources' of type

Bugs: I want to update Realm database from version 4.2.0 to 4.3.3, but after gradle sync, it will fail

Goal

Update Realm from 4.2.0 to 4.3.3

Expected Results

Gradle sync will success

Actual Results

Gradle sync failed with stacktrace:

Error:Execution failed for task ':QuizApp:processDebugResources'.
Could not get unknown property 'packageForR' for task 
':QuizApp:processDebugResources' of type 
com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.

Top level gradle file

buildscript {
repositories {
    jcenter { url 'http://jcenter.bintray.com/' }
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://plugins.gradle.org/m2/" }
    jcenter()
    mavenCentral()
    google()
}
dependencies {
    // classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.android.tools.build:gradle:3.2.0-alpha01'

    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
    classpath 'io.fabric.tools:gradle:1.+'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath "com.github.nullstress:DependencyAnalysisPlugin:1.0.3"
    classpath 'com.google.gms:google-services:3.1.0'
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
    classpath "io.realm:realm-gradle-plugin:4.3.2"
    classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2'
}
  }

I Try cleaning gradle cache and stop the gradle daemon. Then retry the build. But the problem remains

like image 281
Iman Marashi Avatar asked Feb 09 '18 20:02

Iman Marashi


1 Answers

If you are using ButterKnife, just remove ButterKnife gradle plugin, and use the annotationProcessor + implementation version instead. See step bellow:

  1. Remove apply plugin: 'com.jakewharton.butterknife' in gradle
  2. Just use/add dependencies below in gradle instead:

    dependencies {
        implementation 'com.jakewharton:butterknife:8.8.1'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    }
    
like image 134
Chivorn Avatar answered Sep 21 '22 14:09

Chivorn