Gradle build errors with Android Studio

前端 未结 3 1749
谎友^
谎友^ 2021-01-12 11:50

When I try to build my project in Android Studio I get the following error, using the gradle plugin provided with the download (v 1.6):

The specified Gradle in

相关标签:
3条回答
  • 2021-01-12 11:59

    I think the problem is with the way Eclipse 22 exports the project. In the end the way I got my project transferred over was to create a new project in Android Studio and copy over the files from my Eclipse project into the appropriate directories in the new project.

    The directory structure of projects in Android Studio is very different to the structure in Eclipse, and there are several files created when you start a new project which you don't get when importing a project from Eclipse (e.g. gradlew.bat, settings.gradle).

    0 讨论(0)
  • 2021-01-12 12:09

    I also had this problem which can indeed be worked around with Mark's suggestion of using ./gradlew assemble.

    However, this does not help you run Make Project from within Android Studio.

    To do that, I had to go to Preferences / Gradle / Use local gradle distribution

    and select any random (but NOT gradle) folder inside the project folder.

    You might notice that this is marked as an invalid location, but you can ignore that, it seems...

    Not a great solution, but it works.

    0 讨论(0)
  • 2021-01-12 12:11

    I had a similar problem and I believe that it was caused by having multiple versions of gradle on my machine. The solution I found was to use the script that Android Studio creates in your project folder (either gradlew (MacOs/Unix) or gradlew.bat (Windows)):

    ./gradlew assemble
    

    This causes the correct version of gradle to be run - i.e. the version that was shipped with Android Studio.

    I haven't tried creating a project within Eclipse, so I'm not sure if these scripts are created when creating your project in that way.

    0 讨论(0)
提交回复
热议问题