Could not find method android() for arguments

后端 未结 4 1711
不知归路
不知归路 2020-11-27 05:23

I\'ve been trying to import a project to Android Studio and this is where I am stuck, there is a similar question on Stack Overflow but it did not provide a solution to my p

4条回答
  •  天涯浪人
    2020-11-27 05:48

    My issue was inside of my app.gradle. I ran into this issue when I moved

    apply plugin: "com.android.application"
    

    from the top line to below a line with

    apply from:
    

    I switched the plugin back to the top and violá

    My exact error was

    Could not find method android() for arguments [dotenv_wke4apph61tdae6bfodqe7sj$_run_closure1@5d9d91a5] on project ':app' of type org.gradle.api.Project.
    

    The top of my app.gradle now looks like this

    project.ext.envConfigFiles = [
            debug: ".env",
            release: ".env",
            anothercustombuild: ".env",
    ]
    
    
    apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
    apply plugin: "com.android.application"
    

提交回复
热议问题