1. 程式人生 > >【已解決】Could not get unknown property 'packageForR' for task ':app:processDebugResources'

【已解決】Could not get unknown property 'packageForR' for task ':app:processDebugResources'

匯入專案報錯:

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

問題描述:這個是因為專案gradle版本和butterknife版本引起的問題

解決辦法:

原先專案配置:

Grable 使用的是: classpath 'com.android.tools.build:gradle:3.5.1'

butterknif 使用的是:8.8.1

修改為:

project


dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
app:


implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
修改後重新編譯即可
--------------------- 
作者:qq_33649832 
來源:CSDN 
原文:https://blog.csdn.net/qq_33649832/article/details/80190665 
版權宣告:本文為博主原創文章,轉載請附上博文連結!