Android編譯報錯:org.jetbrains.plugins.gradle.tooling.uti

新建了一個基於ReactNative version0.60.5的新項目,在使用Android Studio編譯項目的時候build了以下錯誤:android

org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()

從報錯類型看是gradle的版本問題,google後發現是應該是android的IDE版本(3.1.2)過低,和項目的gradle版本沒法兼容致使。
項目中的版本爲,經過查看/gradle/wrapper/gradle-wrapper.properties 文件中的內容,看到下面是5.4.1git

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

考慮項目兼容問題,目前考慮下降gradle的版本,改下下面這樣:github

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

你覺得這樣就完事了?too young too simple.
從新build就報了以下錯誤:api

Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

怎麼辦?接着搞唄。
進入Android根目錄的build.gradle文件,修改以下:微信

dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        // 修改上面的gradle版本成下面的:
        classpath("com.android.tools.build:gradle:3.3.0")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

從新build項目就ok了。app

歡迎關注個人公衆號:君偉說。
我的微信公衆號.jpg
我的網站:https://wayne214.github.ioide

相關文章
相關標籤/搜索