Google Glass SDK: Gradle sync failed: Cause: failed to find target Google Inc.:Glass Development Kit Preview:19

若如初见. 提交于 2019-12-31 04:37:12

问题


I am getting this error after importing and trying to build the gdk-apidemo-sample-master in Android Studio:

Gradle sync failed: Cause: failed to find target Google Inc.:Glass Development Kit Preview:19

Please advice. Thanks


回答1:


I had the same problem and seems to be gradle doesn't support GDK in the newer versions. Open Android Studio and click open, under File menu, and select the directory of your project. In Top-Level build.gradle file, change the 8th line with classpath 'com.android.tools.build:gradle:2.2.3' and the 20th line runProGuard false with minifyEnabled false. In gradle-wrapper.properties file change last part of the 6th line with gradle-2.14.1-all.zip. After that click on Try Again and it will work. If it ask you to update gradle version always ignore it, because if you update gradle it doesn't recognize the GDK. To start app in google glass also change the settings in Run menu, Edit Configurations. In Launch Options select nothing, beacause glassware doesn't have default activity.




回答2:


Step by step solution, that works for me on the newest Android Studio 3.1.2:

  1. Close the Android Studio.
  2. Change classpath in the <your_main_project_directory>/build.gradle to new one (currently classpath 'com.android.tools.build:gradle:3.1.2' works good).
  3. Start Android Studio and open your project again.

IDE will now correctly inform you about any other necessary updates. You can safely accept updating Gradle version, as it's working good now. At least in my project everything went flawlessly.

Examples of IDE prompts after above line change and opening the project:

Edit: As @Marcello Cuoghi said you might also need to select Launch: Nothing in the Run->Edit Configurations...->Launch Options. Also in the app/build.gradle file change runProguard false to minifyEnabled true (usually not needed, but I had such once).



来源:https://stackoverflow.com/questions/48943985/google-glass-sdk-gradle-sync-failed-cause-failed-to-find-target-google-inc-g

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