1. 程式人生 > >Eclipse常見問題及解決

Eclipse常見問題及解決

一.The environment variable HOME is not set.

  1. 詳細日誌:
eclipse.buildId=4.5.2.M20160212-1500 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN Framework arguments: -product org.eclipse.epp.package.java.productCommand-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.productorg.eclipse.egit.ui 
Warning: The environment variable
HOME is not set. The following directory will be used to store the Git user global configuration and to define the default location to store repositories:'C:\Users\admin'. If this is not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and EGit might behave differently since they see different configuration options. This warning can be switched off on
the Team > Git > Confirmations and Warnings preference page.

2.日誌分析:重點是The environment variable HOME is not set.這句話,也就是沒有配置“HOME”這個環境變數。
3.解決辦法:新建“HOME”環境變數,值為 “%USERPROFILE%”,即可解決。
4.備註:USERPROFILE是用來存放使用者資訊路徑的變數名,可以在命令列下輸入“set USERPROFILE”檢視具體的路徑。如果配置HOME變數後使用git提交程式碼時提示輸入賬戶和郵箱,並在輸入賬戶和郵箱名後提示拒絕訪問的話,可以在USERPROFILE路徑下新建一個名為“_netrc”的檔案,裡面的內容為
“machine github.com
login your-usernmae
password your-password”,然後繼續使用git提交,按照提示輸入賬戶和郵箱就不會再提示拒絕訪問。

二.Multiple dex files define.

1.詳細日誌:

Conversion to Dalvik format failed:
Unable to execute dex: 
Multiple dex files define Lcom/baidu/location/Address$1;

2.日誌分析:重點是Multiple dex files define這句話,意思是說定義了多個同樣的檔案,一般情況下是指libs資料夾中包含了兩個相同jar的包。比如我的這個異常就是說libs資料夾下有兩個關於百度定位的jar包,但大家遇到這種異常 大部分情況下都是有兩個v4包。
3.解決辦法:對於相同的jar包,隨便刪除一個即可。

三.如何匯入Android工程到eclipse

File->import->android->Exiting Android Code Into WorkSpace->Browse選中需要匯入的工程->finish.
1.這裡寫圖片描述
2.這裡寫圖片描述
3.這裡寫圖片描述
4.這裡寫圖片描述

四.overlaps the location of another project

1.場景:將一個工程直接複製到當前工作空間下,之後匯入該工程時會失敗,在details裡會給出這個提示。
2.原因:當前工作空間下已存在同名的工程,所以不能重複匯入。
3.解決:匯入工程時不要直接將工程複製到當前工作空間下。可以先將工程複製到桌面上,然後在匯入工程的時候勾選上“Copy project into workspace”,之後刪除桌面上的工程即可。

五.eclipse control+alt+down不能使用

1.描述:eclipse中使用control+alt+down,整個螢幕倒置了。
2.原因:快捷鍵衝突。
3.解決:右鍵點選桌面空白處 –>圖形選項–>快捷鍵 –>禁用 。
或者點選圖形屬性——>找到ctrl+alt+up 和ctrl+alt+down禁用掉就好了