Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

android - "Gradle project refresh failed" error just after install Studio 2.2.1 (no coding!)

I will really appreciate any help or insight here.

I need to config Android Studio (2.2.1 latest) but it is being a pain! Just after to be installed, I use the wizard (new project) to create a totally blank "app" only using defaults.

Just after the app to be created, AS2 give me this: Gradle 'MyApplication' project refresh failed like in the following image:

error

It is VERY frustrating when you install a program, use all defaults to make something, and it gives an error just on open!

I tried to reinstall everything, even cleaning .java, .gradle, .androidXXX, tryed so many solutions here in the SoF, and still nothing. Same error since yesterday!

My specs:

  • Java 1.8 Oracle (with JDK, everything working in other programs)
  • Linux Mint 18
  • Android Studio 2.2.1
  • Gradle 2.14.1 (as i can see in android-studio/gradle/ folder)

Please, any help, idea, guessing or any else for this? Thanks in advance!

--edit--
Some logs that could be relevant:

2016-10-17 01:01:50,059 [  67026]   INFO - radle.project.ProjectSetUpTask - Process 'command '/home/sidney/bin/android-studio/jre/bin/java'' finished with non-zero exit value 2

Consult IDE log for more details (Help | Show Log) 
2016-10-17 01:01:50,059 [  67026]   INFO - ls.idea.gradle.GradleSyncState - Sync with Gradle for project 'My Application' failed: Process 'command '/home/sidney/bin/android-studio/jre/bin/java'' finished with non-zero exit value 2

Consult IDE log for more details (Help | Show Log) 
2016-10-17 01:01:50,176 [  67143]   WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'My Application' is disabled because the project doesn't contain any valid native configurations. 
2016-10-17 01:01:50,444 [  67411]   INFO -       #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s. 
2016-10-17 01:01:50,448 [  67415]   INFO -       #com.jetbrains.cidr.lang - Loading symbols finished in 0 s. 
2016-10-17 01:01:50,453 [  67420]   INFO -       #com.jetbrains.cidr.lang - Building symbols finished in 0 s. 
2016-10-17 01:01:50,454 [  67421]   INFO -       #com.jetbrains.cidr.lang - Saving symbols finished in 0 s. 
2016-10-17 01:02:59,434 [ 136401]   WARN - ConfigurableExtensionPointUtil - ignore deprecated groupId: editor for id: editor.preferences.import 
2016-10-17 01:03:25,793 [ 162760]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /home/sidney/bin/android-studio/jre 
2016-10-17 01:03:25,794 [ 162761]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /home/sidney/bin/android-studio/jre 

--edit--
Since AS Gradle Console won't let me type, I've installed gradle system-wide via apt-get and run gradle --debug on MyApplication root. The output can be seen here (too long to post here)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In the debug output, you can see

Instructing gradle to use java from /home/sidney/bin/android-studio/jre

Now, if you notice that path, that's the JRE, not the Oracle JDK. I'm honestly not sure why Android Studio ships with a buggy Java JRE, what version it is, why it's the default, or even recommended, but find the IDE settings for setting up the correct JDK.

Hopefully it'll run successfully after that.

It might take a while to build and download some dependencies the first time, but should be faster after that. If you don't plan on downloading many libraries to start out, you can enable Offline Mode to have it be quicker


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...