DraggableGridView不能被包含在项目 [英] DraggableGridView can't be included in project

查看:184
本文介绍了DraggableGridView不能被包含在项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想包括 thquinn的 DraggableGridView 到我的项目。我跟着入门包括的这些步骤添加的jar到我的项目。 ( DraggableGridView.jar 是示出作为参考库)。

I am trying to include thquinn's DraggableGridView into my project. I followed all the instructions given there for getting started including these steps for adding a jar to my project. (DraggableGridView.jar is showing as a referenced library.)

它编译正确,但我跑项目时,我得到的logcat以下错误:

It compiles correctly, but when run my project I get the following error in Logcat:


I/dalvikvm(798): Could not find method com.animoto.android.views.DraggableGridView.addView, referenced from method com.example.GuessWhat.GuessWhat.loadImages
W/dalvikvm(798): VFY: unable to resolve virtual method 11: Lcom/animoto/android/views/DraggableGridView;.addView (Landroid/view/View;)V
D/dalvikvm(798): VFY: replacing opcode 0x6e at 0x003a
E/dalvikvm(798): Could not find class 'com.animoto.android.views.DraggableGridView', referenced from method com.example.GuessWhat.GuessWhat.onCreate
W/dalvikvm(798): VFY: unable to resolve check-cast 15 (Lcom/animoto/android/views/DraggableGridView;) in Lcom/example/GuessWhat/GuessWhat;
D/dalvikvm(798): VFY: replacing opcode 0x1f at 0x0023
D/AndroidRuntime(798): Shutting down VM
W/dalvikvm(798): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
E/AndroidRuntime(798): FATAL EXCEPTION: main
E/AndroidRuntime(798): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.GuessWhat/com.example.GuessWhat.GuessWhat}: android.view.InflateException: Binary XML file line #3: Error inflating class com.animoto.android.views.DraggableGridView
E/AndroidRuntime(798):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime(798):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(798):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(798):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(798):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(798):  at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(798):  at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(798):  at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(798):  at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(798):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

下面是我的导入:

import com.animoto.android.*;

在我的活动我有:

DraggableGridView dgv = ((DraggableGridView) findViewById(R.id.dgv));
ImageView iv = new ImageView(getApplicationContext());
iv.setImageDrawable(new BitmapDrawable(Images[index]));
dgv.addView(iv);

最后一行就是构建误差。我缺少什么?

The last line is where the build error is. What am I missing?

推荐答案

首先,作为Eclipse可以解决你的依赖,但Dalvik的不能,似乎库与您的应用程序捆绑在一起。这样做的典型原因是添加你的库作为一个普通的Java依赖关系到 / lib目录,而建设的Andr​​oid预计 /库的jar 又见这个问题。

First of all, as Eclipse can resolve your dependency but Dalvik cannot, it seems that the library wasn't bundled with your application. The typical cause of this is adding your library as a normal Java dependency into /lib, whereas building for Android expects the jar in /libs. See also this question.

第二,<一个href=\"https://github.com/thquinn/DraggableGridView/blob/master/src/com/animoto/android/views/DraggableGridView.java\"相对=nofollow>查看源码,看来你的进口未正确指定。 DraggableGridView的限定名称 com.animoto.android.views.DraggableGridView

Secondly, looking at the source, it appears that your import is not specified correctly. DraggableGridView's qualified name is com.animoto.android.views.DraggableGridView.

您活动应该申报进口为:

Your activity should declare the import as:

import com.animoto.android.views.DraggableGridView;

这篇关于DraggableGridView不能被包含在项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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