Eclipse和Android的SL网格布局不一起工作 - " android.support.v7.widget.GridLayout不能被实例化" [英] Eclipse and Android SL GridLayout not working together - "android.support.v7.widget.GridLayout could not be instantiated"

查看:315
本文介绍了Eclipse和Android的SL网格布局不一起工作 - " android.support.v7.widget.GridLayout不能被实例化"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的Andr​​oid开发,因此有可能这是一个简单的问题。道歉,如果它是 - 我花了相当长的一段时间来寻找,但找不到任何工作。

I'm new to Android development, so it's possible this is a simple question. Apologies if it is - I spent quite some time searching but couldn't find anything that worked.

我试图用一个网格布局在我的项目,但理想与Android的支持库,所以我可以针对低版本的API。当我拖动一个网格布局进入图形布局设计,会弹出一个对话框,询问解释我需要超过14 API版本兼容库,并问我是否要安装这个库。我点击安装,让Eclipse中做它的事,而是一个错误出现在Eclipse的图形化布局设计: 以下类不能被实例化: - android.support.v7.widget.GridLayout 了解更多详情截图<;看到错误日志(查看查看窗口&GT)。 / A>)

I'm trying to use a GridLayout in my project, but ideally with the Android Support Library so I can target lower versions of the API. When I drag a GridLayout into the graphical layout designer, a message pops up asking explaining I need a compatibility library for API versions older than 14, and asks if I want to install this library. I hit "Install" and let Eclipse do its thing, but an error shows up in the Eclipse graphical layout designer: The following classes could not be instantiated: - android.support.v7.widget.GridLayout See the Error Log ( Window > Show View) for more details. (Screenshot)

这是错误日志, android.support.v7.widget.GridLayout失败的实例。 这里的堆栈跟踪

我寻找这个错误止跌回升<一个href="http://stackoverflow.com/questions/10773981/eclipse-giving-an-error-of-android-support-v7-widget-gridlayout-failed-to-instan">this SO线程,这似乎有希望的;我检查了我的Java,Eclipse和ADT版本,但似乎都合理了最新的(Java 7的更新17,Eclipse的朱诺发布,ADT 21.1)。随着更新检查出的方式,我看着怎么说SO用户已经自己建立的项目:一个库项目的网格布局,一个项目引用该库的主要项目,而网格布局的jar复制到主项目库夹。继月食安装兼容库的消息,一个网格布局库项目已经为我创建的,但该项目基准尚未建立和GridLayout的罐子并没有被复制。我做了这两个东西,但仍然是GridLayout的失败实例。

My search for this error turned up this SO thread, which seemed promising; I checked my Java, Eclipse and ADT versions but all seem to be reasonably up-to-date (Java 7 update 17, Eclipse Juno release, ADT 21.1). With the update checks out of the way, I looked at how that SO user had his project set up: a library project for the gridlayout, a project reference to this library in the main project, and the gridlayout jar copied into the main project's libs folder. Following the Eclipse "install compatibility library" message, a gridlayout library project had already been created for me, but the project reference had not been set up and the gridlayout jar hadn't been copied. I did both these things but still the GridLayout fails to instantiate.

我继续搜索,发现<一href="http://stackoverflow.com/questions/12468606/intellij-and-android-support-v7-widget-gridlayout">another SO线程。尽管没有使用Eclipse该线程,我尝试翻译答案到Eclipse当量,为大致相同,若由线程以上。 (复制GridLayout的罐子到项目的libs文件夹,创建网格布局库项目,并从主项目中添加项目引用该库项目。)我也验证了GridLayout的罐子是主要项目的构建路径上。 (截图

I continued searching and found another SO thread. Despite that thread not using Eclipse, I attempted to translate the answer into the Eclipse equivalent, which was roughly the same as given by the thread above. (Copy the gridlayout jar to the project's libs folder, create a library project from gridlayout, and add a project reference to that library project from within the main project.) I also verified that the gridlayout jar is on the main project's build path. (Screenshot)

我也试图遵循相关造型的Andr​​oid博文的说明,但是这更糟糕:当我尝试一个网格布局拖到我的项目,它抛出两个错误,一个 RelativeLayoutRule.onDropped()失败: 显示java.lang.NullPointerException 该堆栈跟踪初始化项目状态该堆栈跟踪。根据在初始化项目状态堆栈跟踪中提到的IOException异常,我推测这个问题可能是我的安装​​位置为Android SDK:%APPDATA%\本地\ Android版。我终于尝试卸载SDK并重新安装到%PROGRAMFILES%\ Android版,但没有任何运气。

I also attempted to follow the instructions in the relevant Styling Android blogpost, but that's even worse: when I try to drag a GridLayout into my project, it throws two errors, a RelativeLayoutRule.onDropped() failed: java.lang.NullPointerException with this stack trace and an Initializing project state with this stack trace. Based on the IOException mentioned in the "Initializing project state" stack trace, I speculated the problem might be my install location for the Android SDK: %APPDATA%\Local\Android. I finally tried uninstalling the SDK and reinstalling it to %PROGRAMFILES%\Android but without any luck.

我真的不知道从哪里何去何从。如果任何人都可以给我在正确的方向指针,我真的AP preciate了!

I'm not really sure where to go from here. If anyone could give me a pointer in the right direction, I'd really appreciate it!

推荐答案

试试: 文件 - >导入 - >现有的Andr​​oid code到工作区 指定的Andr​​oid sdk- [台] /演员/安卓/支持/ V7 /网格布局

Try: File->Import->Existing Android code into workspace Specify android-sdk-[platform]/extras/android/support/v7/gridlayout

您需要将GridLayout的项目导入作为一个Android库项目为它工作。

You need to import the GridLayout project as an Android library project for it to work.

这篇关于Eclipse和Android的SL网格布局不一起工作 - &QUOT; android.support.v7.widget.GridLayout不能被实例化&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆