"Glass Development"-the first sample

Source: Internet
Author: User

One get sample

The simplest way to learn, of course, is to imitate an example. Android Studio's GDK itself does not take its own example. The examples are on GitHub.

Https://github.com/googleglass

Gdk-apidemo-sample Ah, gdk-timer-sample Ah, gdk-compass-sample Ah, are relatively simple can be down to play.

There are just a few.

Scenario 1: Download the sync sample using Android Studio integrated git

Of course, the official GDK Quick start document also shows that

Https://developers.google.com/glass/develop/gdk/quick-start#setting_up_the_development_environment

Android Studio it integrates the GIT function and synchronizes the sample.

650) this.width=650; "border=" 0 "width=" 554 "height=" 436 "src=" http://s3.51cto.com/wyfs02/M00/6F/38/ Wkiom1wu6foaqvadaag4foh_vgc678.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 1.png "/>

650) this.width=650; "border=" 0 "width=" 554 "height=" 119 "src=" http://s3.51cto.com/wyfs02/M01/6F/36/ Wkiol1wu6iqjv8wtaad-ll71ifi027.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 2.png "/>

Things about git and GitHub are not here to be said.

650) this.width=650, "border=" 0 "width=" 313 "height=" src= "http://s3.51cto.com/wyfs02/M01/6F/38/" Wkiom1wu6g-gkgrdaad4fjutgsw927.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 3.png "/>

Open version Control

650) this.width=650; "border=" 0 "width=" 534 "height=" 168 "src=" http://s3.51cto.com/wyfs02/M02/6F/36/ Wkiol1wu6koq0nh9aadkg4wclvc434.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 4.png "/>

Trying to get sample from Git

Due to the Windows environment, it is possible that Android studio comes with a Git.exe that is not so good

650) this.width=650; "border=" 0 "width=" "height=" 530 "src=" http://s3.51cto.com/wyfs02/M02/6F/36/ Wkiol1wu6orwhw8gaapgjszveek532.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" Clipboard.png "/>

Download Git for Windows on your own

Then set the path yourself

650) this.width=650; "border=" 0 "width=" 799 "height=" "src=" http://s3.51cto.com/wyfs02/M00/6F/36/ Wkiol1wu6qgwfnwnaacfcbzhm6e642.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 6.png "/>

Scenario 2: Use the browser to open the GitHub Web page download project file zip--

Without detailed explanation, the front is linked.

Two Sample run up

First of all, of course when you try to open sample, you will find that he is still just a folder, not a project that lacks the necessary project description files as an Android studio project.

Please use the Gradlew.bat in the directory to convert the target project to an Android Studio project

650) this.width=650; "border=" 0 "width=" 441 "height=" 285 "src=" Http://s3.51cto.com/wyfs02/M02/6F/36/wKioL1WU6t_ G-ayraaewyatec2c175.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center; border:1px solid #ddd; "alt=" Spacer.gif "title=" 1.png "/>

in short, Use Administrator privileges to open the Gradlew.bat in the directory to convert. A certain version of Gradlew will be installed in the conversion. Then it doesn't have to have any eggs.

You can see the version you have in the folder below

650) this.width=650; "border=" 0 "width=" 529 "height=" 148 "src=" http://s3.51cto.com/wyfs02/M00/6F/36/ Wkiol1wu6vfqhugdaaclay4spae373.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 2.png "/>

Then it may still fail.

Like a mistake.

Error:could not normalize path for file ' C:\Users\yieux0\Documents\GoogleGlassProject\Sample\ Gdk-apidemo-sample-master\app\build\intermediates\mockable-googleinc.:glass Development Kit Preview:19.jar '.

The file name, directory name, or volume label method is incorrect.

This is in fact you do not have the corresponding version of the Gradlew, or do not use the corresponding version. How do you know where your problem is?

You can see the error message when you insert some pauses in the bat in the order of execution, for example

650) this.width=650; "border=" 0 "width=" 643 "height=" 498 "src=" http://s3.51cto.com/wyfs02/M02/6F/36/ Wkiol1wu6wkcomlpaajh3sadf7g509.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 3.png "/>

And the 21 lines in Build.gradle are the following:

Proguardfilesgetdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '

650) this.width=650; "border=" 0 "width=" 797 "height=" 111 "src=" http://s3.51cto.com/wyfs02/M01/6F/38/ Wkiom1wu6u7c90spaabxrjbcztk090.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 4.png "/>

So the problem is simple, it is to find that TXT did not find. Why didn't you find the SDK path wrong?

Because he was looking for it through the environment variable android_home. You didn't set this environment variable, of course not.

If you open with Android Studio, it will generate local.properties, it looks like the address is right, but it only means androidstudio know your SDK dir but it gradlew.bat not know Ah!

so you just need to add suitable environment variable android_home, pointing to the Android SDK root directory is OK.

Of course, there could be such a mistake.

Line 20th is runproguard false

650) this.width=650; "border=" 0 "width=" 647 "height=" 312 "src=" http://s3.51cto.com/wyfs02/M02/6F/36/ Wkiol1wu6ypj2aziaajydfsmhrg342.jpg "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "title=" 5.png "/>

Gradle Can't find this function, blame me?

The reason is because the current default Gradle version is too high. Maybe it's because you recently got a project that uses a high version of Gradle, or your Android studio has been updated. As we have just said, each time you run Gradlew.bat with administrator privileges, you will be given the appropriate version to install.

You can modify the Gradle version of the specified item to an older version, but the most appropriate method is to use the new version of the corresponding function instead

Runproguard false ==> minifyenabled false


This article from the "Wooden Dragon Belly" blog, reproduced please contact the author!

"Glass Development"-the first sample

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.