I just tried out the updated gdk on my glass XE 20.1 and my testing app crashed because the new api is not available.
CardBuilder card = new CardBuilder(this, CardBuilder.Layout.TEXT);
(The old Card constructor is deprecated. Builder pattern is replacing it.)
Log:
09-09 00:27:16.239 1992-1992/com.prat.testgdk E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.prat.testgdk, PID: 1992
java.lang.NoClassDefFoundError: com.google.android.glass.widget.CardBuilder
at com.prat.testgdk.MainActivity.buildView(MainActivity.java:95)
at com.prat.testgdk.MainActivity.onCreate(MainActivity.java:40)
On other Android devices, I can check android.os.Build.VERSION.SDK_INT or set minSdkVersion but on Glass SDK_INT won't get updated when the new sdk comes out.
What's the proper way to deal with this? Is there a better way than using reflection to test for the availability of specific classes?
Am I missing something?
Edit:
Based the API demo, it seems like we shouldn't care. Let it break on the old XEs. Hopefully, all Glasses are getting updated soon. See https://github.com/googleglass/gdk-apidemo-sample/commit/e644c7325bb74a02b0f383bf9f19e9f851313dc2