简体   繁体   中英

Cannot get tutorial app to work - Android

So I am following this tutorial to create my first "hello world"-type app and there is something that's not right.

At first everything was working (somewhat). I was able to successfully add a TextEdit and a Button to my app, compile and debug it on my device. But even after precisely following the steps in the tutorial, the button was not aligned as they said it should be. It was overlapping the TextEdit. But that's not the main issue.

Tha main issue is this. After completing the tutorial, I can no longer compile or debug my app because it throws exceptions:

Gradle: 
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Notes:compileDebug'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

and:

Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

Why isn't this working? I have followed all steps exactly as they're written and I just can't make any sense of it. There are other "First tutorial app problems" on here for the same tutorial but after reading them they all have their own different problems.

Update

After posting this question, I found anothe link in the related section, saying to run gradlew compileDebug in the root folder command line so I did and it returned:

在此处输入图片说明

Based on this information below in the image, does this mean that I should just replace TaskContainer.add() with create() and it'll be fine?

As eclipse user I am not familiar with android studio, but according to your screenshot it actually seems to be caused by the deprecated method you're using.

I guess you can't "just" replace te name of the method you're using, because create will most likely work a little different. But yeah, if you work it out to do the same in the end you should be fine.

EDIT:

Oh, and what I just saw: Did it already work before? Because if not, look at the error about the missing Java compiler. Look up, how to add this to your HOME Path variable!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM