Android Studio 2.2 preview1 errors

我们两清 提交于 2019-11-28 08:00:00

问题


So i'm trying to use Android Studio 2.2 preview-1 in Ubuntu 14.04 LTS.

I'm using gradle-2.10 and gradle-plugin 2.2.0-alpha1 along with openJDK-8.

compileSdkVersion 23
buildToolsVersion "23.0.3"

First the studio.sh didn't run and i found the solution to change #!/bin/sh to #!/bin/bash. Voila --it starts properly.

But in build.gradle files, warning is shown--

'dependencies' cannot be applied to '(groovy.lang.Closure)'

and its not finding imported class from library project(includes a jar only). Please someone help me out.


回答1:


The only fix that I found for this is, every time I open a project, I go to Settings>Build, Execution, Deployment>Gradle, change to "use local gradle distribution", click apply then click "use default gradle wrapper" and ok.

This should fix, but its quite annoying to do this everytime.




回答2:


It Looks like a problem of version 2.10 of the wrapper version on gradle.

After reading around people's workaround like

  • "invalidate cache and restart"
  • delete .gradle file in the project and re-open it
  • etc etc

I just try for fun to install a standalone version of gradle since I'd always used only the wrapper version that cames with android studio.

And with it there is any error and any warning.

For anyone who wanna try (I'm a mac's user):

  • install gradle (by homebrew is fine and pretty easy) brew install gradle
  • tell to AS to use that one instead the wrapper version preference -> build, Execution, Deveployment -> Gradle -> use local gradle distribution

if you install it by homebrew like me the correct path will be: /usr/local/Cellar/gradle/x.yy/libexec where x.yy it suppose to be 2.11 (that is the last version provide by brew even if the lastest version released is 2.13)


I've realised just now that the steps above doens't fix the definitly. Each time you re-open the project the problem came again and again. It's annoying but changing betwen use of "wrapper"/"regular gradle" take the warning away. But this means also that isn't a problem o the gradle as I'd assumed at the beginning.

...let's wait a permanent fix ^^




回答3:


This issue is fixed in Android Studio 2.2 preview 2 (download from this page).

Disabled a couple of Groovy inspections that reported incorrect errors in build.gradle files

From the changelog.



来源:https://stackoverflow.com/questions/37338186/android-studio-2-2-preview1-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!