问题描述
我想用伽马组件在Android中,使我们的应用程序good.I已经下载达伽马即使它扔error.I罐子都遵循以下链接的。
的Java
进口android.app.Activity;
进口android.os.Bundle;
进口android.widget.Button;
进口com.digitalaria.gama.tile.Tile;
公共类GamaAndroidActivity延伸活动{
Button按钮;
/ **第一次创建活动时调用。 * /
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.main);
}
}
XML
< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直>
< com.digitalaria.gama.tile.Tile
机器人:ID =@ + ID /瓦
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_horizontal/>
错误
07-02 16:52:02.623:E / AndroidRuntime(1849年):致命异常:主要
07-02 16:52:02.623:E / AndroidRuntime(1849年):java.lang.RuntimeException的:无法启动的活动ComponentInfo {com.test.gama / com.test.gama.GamaAndroidActivity}:android.view.InflateException:二进制XML文件行#7:错误充气类com.digitalaria.gama.tile.Tile
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.os.Handler.dispatchMessage(Handler.java:99)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.os.Looper.loop(Looper.java:123)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread.main(ActivityThread.java:4627)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在java.lang.reflect.Method.invokeNative(本机方法)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在java.lang.reflect.Method.invoke(Method.java:521)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在dalvik.system.NativeStart.main(本机方法)
07-02 16:52:02.623:E / AndroidRuntime(1849年):android.view.InflateException:二进制XML文件中的行#7:错误充气类com.digitalaria.gama.tile.Tile所致
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.Activity.setContentView(Activity.java:1647)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在com.test.gama.GamaAndroidActivity.onCreate(GamaAndroidActivity.java:15)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-02 16:52:02.623:E / AndroidRuntime(1849):11 ...更多
07-02 16:52:02.623:E / AndroidRuntime(1849年):抛出java.lang.ClassNotFoundException:产生的原因com.digitalaria.gama.tile.Tile装载机dalvik.system.PathClassLoader [/data/app/com.test .gama-1.apk]
07-02 16:52:02.623:E / AndroidRuntime(1849年):在dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.createView(LayoutInflater.java:466)
07-02 16:52:02.623:E / AndroidRuntime(1849年):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
07-02 16:52:02.623:E / AndroidRuntime(1849):20 ...更多
错误说
这意味着你必须在7号线的误差在XML文件中,你正在声明com.digitalaria.gama.tile.Tile因此检查这个类是可用的。
在你的类,你正在使用的XML文件放:
进口com.digitalaria.gama.tile.Tile;
编辑:
要添加伽马库从javaBuildpath删除它,这样做,而不是:
1.创建一个新的文件夹,库,在Eclipse / Android项目。
2.右键单击库,选择导入 - >一般 - >文件系统,然后
接下来,在文件系统中浏览查找该库的父
目录,并添加您的GAMA罐子。
你的项目3.右键单击,选择构建路径 - >配置构建
路径,然后单击Libraries选项卡,然后添加JAR文件...,浏览到
新的JAR的库目录,并添加它。
4.清洁工程
I want to use Gama component in Android to make our app good.I have already download jar of Gama even it throwing error.I have followed following link http://developer.digitalaria.com/devguide/gama/en/gama/tile_android.php.
Java
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import com.digitalaria.gama.tile.Tile;
public class GamaAndroidActivity extends Activity {
Button button;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.digitalaria.gama.tile.Tile
android:id="@+id/tile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
Error
07-02 16:52:02.623: E/AndroidRuntime(1849): FATAL EXCEPTION: main
07-02 16:52:02.623: E/AndroidRuntime(1849): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.gama/com.test.gama.GamaAndroidActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.digitalaria.gama.tile.Tile
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.os.Handler.dispatchMessage(Handler.java:99)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.os.Looper.loop(Looper.java:123)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-02 16:52:02.623: E/AndroidRuntime(1849): at java.lang.reflect.Method.invokeNative(Native Method)
07-02 16:52:02.623: E/AndroidRuntime(1849): at java.lang.reflect.Method.invoke(Method.java:521)
07-02 16:52:02.623: E/AndroidRuntime(1849): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-02 16:52:02.623: E/AndroidRuntime(1849): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-02 16:52:02.623: E/AndroidRuntime(1849): at dalvik.system.NativeStart.main(Native Method)
07-02 16:52:02.623: E/AndroidRuntime(1849): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.digitalaria.gama.tile.Tile
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-02 16:52:02.623: E/AndroidRuntime(1849): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.Activity.setContentView(Activity.java:1647)
07-02 16:52:02.623: E/AndroidRuntime(1849): at com.test.gama.GamaAndroidActivity.onCreate(GamaAndroidActivity.java:15)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-02 16:52:02.623: E/AndroidRuntime(1849): ... 11 more
07-02 16:52:02.623: E/AndroidRuntime(1849): Caused by: java.lang.ClassNotFoundException: com.digitalaria.gama.tile.Tile in loader dalvik.system.PathClassLoader[/data/app/com.test.gama-1.apk]
07-02 16:52:02.623: E/AndroidRuntime(1849): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-02 16:52:02.623: E/AndroidRuntime(1849): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-02 16:52:02.623: E/AndroidRuntime(1849): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
07-02 16:52:02.623: E/AndroidRuntime(1849): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
07-02 16:52:02.623: E/AndroidRuntime(1849): ... 20 more
The error says
which means that you have an error on line 7 in your xml file where you're declaringcom.digitalaria.gama.tile.Tile so check if that class is available.
In your class where you are using the xml file put :
import com.digitalaria.gama.tile.Tile;
EDIT :
To add Gama library remove it from javaBuildpath and do this instead:
1. Create a new folder, libs, in your Eclipse/Android project.
2. Right-click libs and choose Import -> General -> File System, then
Next, Browse in the filesystem to find the library's parent
directory and add your GAMA jar.
3. Right-click on your project, choose Build Path -> Configure Build
Path, then click the Libraries tab, then Add JARs..., navigate to
your new JAR in the libs directory and add it.
4. Clean the project
这篇关于使用伽马分量的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!