本文介绍了如何启动对谷歌玻璃常规活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找通过GitHub的例子谷歌玻璃和我的code并没有真正发生翻天覆地的变化。除了发射普通的的TextView ,我的code理论上应该工作。我的活动code是:

I have been looking through the github examples for google glass and my code doesn't really look very different. With the exception of launching a regular TextView, my code should theoretically work. My Activity code is:

包com.helloglass;

package com.helloglass;

进口android.os.Bundle;进口android.app.Activity;

import android.os.Bundle;import android.app.Activity;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


    }


}

我的布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World"/>


</FrameLayout>

和我的清单是

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.helloglass"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="15" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="com.helloglass.MainActivity"
            android:label="@string/app_name_hello"
            android:enabled="true" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
    </application>

</manifest>

现在所有我想要做的就是看这个该死的观点弹出,但我不断收到此错误

Now all I want to do is just see the damn view pop up, but I keep getting this error

[2013-11-29 14:04:49 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-11-29 14:04:49 - HelloGlass] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

我测试的例子项目和他们的工作,所以我怀疑它我的Eclipse安装。我想知道我在做什么错在这里,因为它不是在GDK文档很清楚。有几乎没有任何实例这样做。但我的假设是我的code以上也只是沉浸,因为医生说是您可以使用标准的Andr​​oid活动创建浸入。由于没有关于设置什么特别的表现没有任何额外的信息,我看不出有什么我做错了。任何对此的解释是大大AP preciated。

I tested the example projects and they are working, so I doubt its my eclipse installation. I am trying to understand what I am doing wrong here because it isn't very clear in the GDK docs. There are barely any examples doing this. But my assumption is my code above will just be an immersion since the doc says that You create immersions using standard Android activities. Since there is no extra info on setting up anything special in the manifest, I fail to see what I am doing wrong. Any explanation on this would be greatly appreciated.

推荐答案

这是不是一个玻璃特有的问题,而是一个问题与最新版本的Andr​​oid编译工具。你可以尝试一些建议的修复这个线程的底部附近,看看他们是否解决?

This is not a Glass-specific problem, but an issue with a recent version of the Android build tools. Can you try some of the suggested fixes near the bottom of this thread and see if they fix it?

更新:这似乎已经被固定在 19.0.1版本(2013年12月)了Android构建工具。如果您遇到此问题,升级使用Android SDK管理器,看看是否能解决它。

UPDATE: This seems to have been fixed in version 19.0.1 (December 2013) of the Android Build Tools. If you are experiencing this problem, upgrade using the Android SDK Manager and see if that solves it.

这篇关于如何启动对谷歌玻璃常规活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 08:46