/ 中存储网

告诉你用Eclipse在Ubuntu下遇到的一些小问题的方法及命令

2015-01-29 00:00:00 来源:中存储网

在Ubuntu下把工程目录直接拷贝回来放在eclipse到工程目录里居然报错里

前些天公司那么大的项目也都没报错。神奇了

控制台错误代码

Unable to execute dex: wrapper was not properly loaded first
Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first

查了一下。

解决方案:

sudo gedit /usr/program/eclipse/eclipse.ini

找到Eclipse目录下eclipse.ini文件,将最后两句改为
-Xms128m
-Xmx512m
重启eclipse
然后project->clean一下就OK了

第二个问题是使用TabHost遇到de问题

Android study week, when two days with TabHost encountered two problems:

Question 1. When you run the Activity Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'

Add a Layout time, xml with element selection TabHost, but the ADT did not add id attribute, running, will be prompted to Your content must have a TabHost whose id attribute is 'android.R.id.tabhost' error, need to add the android: id = "@ android: id / tabhost", so on it.

Question 2. When you run the Activity Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabcontent'

Solution: Modify FrameLayout Add id attribute, ADT xml file automatically generated Id is the android: id = "@ + id/FrameLayout01", need to modify into the following format android: id = "@ android: id / tabcontent", this estimated to be troubled by a large number of beginners, who would have thought would change this place, see the error is easy to modify into tabcontent, but the prefix is not easy to think of. But also in the ADT visual editing this document, the interface shows NullPointerException, this is ADT's a BUG.

Modified xml as follows:

<? Xml version = "1.0" encoding = "utf-8"?>
<TabHost
android: id = "@ android: id / tabhost"
xmlns: android = "http://schemas.android.com/apk/res/android"
android: layout_width = "fill_parent" android: layout_height = "fill_parent">
<LinearLayout Android:id="@+id/LinearLayout01" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">

<TabWidget Android:id="@android:id/tabs" android:layout_height="wrap_content" android:layout_width="fill_parent">
</ TabWidget>
<FrameLayout Android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent">
</ FrameLayout>
</ LinearLayout>
</ TabHost>

Note: If TabHost, then the above three marked red must be the same, this is Google's agreement. And a project can have only one TabHost.

TabHost,TabWidget以及FrameLayoutde

android:id标签命名一定要按照android的规范 然后就没问题了。