react-native 解決Could not find method android() for arguments問題


運行命令行:react-native run-android 報錯

Error:(23, 0) Could not find method android() for arguments [****] on root project '****' of type org.gradle.api.Project.



最終解決方案:打開項目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:2.2.2'
        classpath 'com.novoda:bintray-release:0.3.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'
}
dependencies {
}

 

將其中的

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'
}
 
        

刪除或注釋掉后重新編譯通過。 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM