Google Glass updated to KitKat, but new methods ar

2019-09-16 15:04发布

问题:

My Google Glass updated itself to KitKat today, and I thought I have gone through and updated Eclipse successfully as well, but Eclipse is throwing errors on the new methods introduced into the GDK by the update. For instance, part of the update was

setText() expects a java.lang.CharSequence

So, I changed my code from

card.setText(some_String);

to

card.setText(some_CharSequence);

however, when I do this, eclipse throws an error, stating that

The method setText(String) in the type Card is not applicable for the arguments (CharSequence)

it wants me to set text as a string, and it won't let me run the application on glass until I change it back. However, once I change it back and try to run it on Glass, the application force quits as soon as it tries to set the text. The error in LogCat traces back to this line too.

java.lang.NoSuchMethodError: com.google.android.glass.app.Cart.setText

I can see in the documentation for the GDK there's no longer any support for a setText method that takes a string as an input.

Things I have done so far: Updated the Android Developer Toolkit to 22.6.2 using the steps found here

Error: This Android SDK requires Android Developer Toolkit version 22.6.1 or above

Installed all the updates for Glass and KitKat found in the SDK Manager

Checked for updates in Eclipse and installed whatever it found

updated the targetSDK and minSDK in my app manifest to 19.

Not sure what to do from here.

回答1:

I know it's really basic, but did you restart Eclipse ADT after installing the new packages? Try cleaning your project to make sure it is using the correct GDK. You may also try going to the project Properties -> Android and make sure the build target is API 19.



回答2:

Make sure that your project's project.properties file contains the following line:

target=Google Inc.:Glass Development Kit Preview:19

I had to change this in a project that originally used the GDK sneak peak version 15.