當前位置:首頁 » 安卓系統 » 如何導入安卓源碼

如何導入安卓源碼

發布時間: 2022-04-21 06:03:09

㈠ 如何導入與配置從網上下載的android源代碼及伺服器端源代碼

將Android項目導入import進Eclipse。 注意SDK版本是否匹配 。 伺服器部署到Tomcat下。 你得在資料庫中將這個點菜系統的資料庫和表建好,或者導入。在伺服器的代碼中修改好你的資料庫名和密碼。

㈡ 如何解決向Eclipse導入安卓代碼出現很多報錯

第一步:導入安卓源碼。把游標放在「Workspace」滑鼠右鍵,點擊「Import」。

第二步:在彈出的「Import」對話框中,選擇「Existing Android Code Into Workspace」然後點擊確定。

第三步:在彈出的「Import Projects 」對話框,點擊「Browse」,然後在彈出的「瀏覽文件夾」對話框中,找到存放安卓源碼的文件夾。然後選中文件夾然後點擊「Finish」.

第四步:出現報錯。

第五步:滑鼠點擊選中該工程,然後滑鼠右鍵。點擊「Android Tools」,然後點擊「Fix Properties」。

第六步:如果還存在報錯。點擊工具欄的「Project 」點擊「Clean」然後在彈出的「Clean」對話框中點擊「OK」。到此時報錯消失。

㈢ Android怎麼導入源代碼並運行

導入的項目有問題吧,一般情況下,jar包或者library有可能發生錯誤,你可以重新設置下路徑

選中當前項目右擊----properties-------Android(左邊)-----查看右下部分有沒沒有library有的話remove再此重新導入

或者:

選中當前項目右擊----properties-------java Build Path-----查看右面4個選項卡有沒有報錯的。。。如果有,同樣,removew在add進入

㈣ 如何移植android 源代碼到自己的手機上

成功將android2.1移植到手機上,需經過以下幾個步驟:
一,准備好android2.1源碼編譯環境以及手機USB調試環境。
二,將手機上硬體驅動程序以及相關的配置文件通過ADB命令保存好。
三,針對不同的手機機型,製作相應的vendor配置文件。
四,編譯源碼。
五,通過手機提供的bootloader刷機或者直接以recovery的方式更新ROM。
在以上五個步驟中,其中最難處理的便是第2個步驟,這個步驟需要熟悉每個手機機型的硬體參數,並且能夠在手機上找到相關的驅動程序以及了解他們如何配置。而CyanogenMod團隊公布的源碼當中,己經將相關的工作做好了,

㈤ 如何導入android sdk 的 sample中的源碼

Sample代碼在SDK安裝目錄(X:\Android\android-sdk\samples)下。但我在用Eclipse 開發環境導入的時候遇到了一些麻煩。網上看到有人是通過「File -> Import...」或「File -> New->Project -> Create Project From Existing Code」解決的,但我試過,都有點問題。後一種方法可成功導入,但工程沒有復制到Eclipse的工作目錄(X:\Eclipse\workspace),這樣作為練習修改後,影響了原有Sample代碼,可能失去了參考,而且還要將原SDK的Sample目錄屬性由只讀改為可寫。
一番倒騰後,我發現,Eclipse已經提供了很方便的導入方法。那就是 "File -> New->Project -> Android Simple Project 」。下面是操作截圖,一看即明,很簡單。
----------------------------
---------------------
選擇你需要的Sample版本。
選擇你需要研究的Sample類型,ApiDemos是最基本的,很適合初學者。按「Finish」就完成了。
如果已經安裝過,你不用擔心會誤操作。

㈥ 如何向eclipse中導入安卓軟體源碼

向eclipse中導入安卓軟體源碼的方法

  • 打開eclipse依次點擊 菜單 > file > import,打開導入項目對話框

  • 步驟閱讀.2選擇 genernal > Existing Projects Into Workspace > 點擊next

  • 步驟閱讀.3選擇Select root directory > browose 去選擇安卓源代碼的根目錄 > 點擊確定

  • 步驟閱讀.4點擊finish軟體自動導入安卓項目到你的工作空間

㈦ 如何用 Intellij 導入 Android 源碼

針對定製源碼或者原生源碼來說,這些准備步驟都是必須的,沒必要再強調了。
2-2 配置導入及使用
2-2-1 編譯源碼idegen模塊及生成AS配置文件(*.ipr)
在開始編譯idegen模塊前,你一定知道需要先全局編譯出out目錄及相關文件吧,這個不再過多說了,我們通過如下命令編譯idegen模塊:
mmm development/tools/idegen/1

這行命令的意思是編譯idegen這個模塊項目,然後生成idegen.jar文件(不信你自己去查看這個模塊的Android.mk的目標吧,不多解釋)。運行完以後如果看到如下信息則說明編譯OK:
......
#### make completed successfully (7 seconds) ####12

接著執行如下腳本
development/tools/idegen/idegen.sh1

這行命令的意思是在根目錄生成對應的android.ipr、android.iml IEDA工程配置文件。等待片刻得到類似如下信息說明OK:
Read excludes: 21ms
Traversed tree: 194799ms12

通過如上操作我們就完成了基本的源碼配置工作。
2-2-2 導入Android Studio前的一些客戶化操作
大家都知道使用Eclipse倒入源碼很慢,Android Studio導入源碼時也慢,所以建議修改android.iml文件(將自己不用的代碼去掉),然後再導入Studio。
就像下面摘取的android.iml文件1887行開始的這些一樣:
<sourceFolder url="file://$MODULE_DIR$/./sdk/testapps/userLibTest/src" isTestSource="true"/>
<sourceFolder url="file://$MODULE_DIR$/./tools/external/fat32lib/src/main/java" isTestSource="false"/>
<excludeFolder url="file://$MODULE_DIR$/out/eclipse"/>
<excludeFolder url="file://$MODULE_DIR$/.repo"/>
<excludeFolder url="file://$MODULE_DIR$/external/bluetooth"/>
<excludeFolder url="file://$MODULE_DIR$/external/chromium"/>
<excludeFolder url="file://$MODULE_DIR$/external/icu4c"/>
<excludeFolder url="file://$MODULE_DIR$/external/webkit"/>
<excludeFolder url="file://$MODULE_DIR$/frameworks/base/docs"/>
<excludeFolder url="file://$MODULE_DIR$/out/host"/>
<excludeFolder url="file://$MODULE_DIR$/out/target/common/docs"/>
<excludeFolder url="file://$MODULE_DIR$/out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates"/>
<excludeFolder url="file://$MODULE_DIR$/out/target/proct"/>
<excludeFolder url="file://$MODULE_DIR$/prebuilt"/>1234567891011121314

我們可以仿照上面這段代碼的<excludeFolder url="file://$MODULE_DIR$/.repo"/>寫法一樣過濾掉不需要的內容,這樣在導入時就會快很多。
也可以通過Android Studio的Project Stucture 打開左側Moles,然後將右側Sources中一些目錄Excluded掉。
2-2-3 使用Android Studio導入源碼工程
有了如上的這些操作以後,我們打開Android Studio,然後選擇打開一個現有的Android Studio項目,然後選擇打開源碼根目錄下的android.ipr文件,然後出現如圖一樣的索引即可等待導入就行:tu

到目前為止我們就可以方便的使用Android Studio查看源碼啦。如下圖所示:

吊不屌!!!
2-3 使用技巧
上圖我們看見了,可以通過Android Studio搜索整套源碼的代碼了。但是這時候如果你打開一個Service.java類,然後把滑鼠放在其中任意方法的Intent參數上按住CTRL+滑鼠左鍵跳轉到Intent類你會發現跳轉過去的是一個Intent.class文件,為啥呢?因為他跳轉的是你的默認SDK中的jar內部的class文件。既然要修改查看整套源碼,這么跳轉得多蛋疼啊,所以我們需要配置讓其能跳轉到Intent.java文件,具體做法如下:
首先刪掉依賴中的所有依賴,只保留下圖中沒被選中的那兩個(當然你可以選擇保留一些你用到的其他jar),如下:

接著點擊加號的JARs or directories將你源碼的frameworks及external和你用到的其他跳轉目錄添加到依賴中,然後apply即可。
這時候我們在像上面一樣打開Service.java跳轉Intent,你會發現像下圖一樣直接跳轉到你源碼路徑下的Intent.java文件了,如下:

到此對於平時只是查看源碼的人來說已經夠用了。
3 總結
俗話說工欲善其事必先利其器,你會發現使用Android Studio比Eclipse和Source Insight都好很多(當然了,SubText還是很強大的),無論是代碼提示還是跳轉、還是Python Shell等插件支持等都很強大,慢慢體驗吧。
順帶說一句,Google的野心真的很大,看來Android Studio即將要被他們打造為全能IDE了。
4 附加README
附上原版的英文README文檔,英語高手直接看這里就行:
IDEGen automatically generates Android IDE configurations for IntelliJ IDEA
and Eclipse. Your IDE should be able to compile everything in a reasonable
amount of time with no errors.
If you』re using IntelliJ…
If this is your first time using IDEGen...

IDEA needs a lot of memory. Add "-Xms748m -Xmx748m" to your VM options
in "IDEA_HOME/bin/idea.vmoptions" on Linux or
"IntelliJ IDEA.app/Contents/Info.plist" on OS X.

Create a JDK configuration named "1.6 (No Libraries)" by adding a new
JDK like you normally would and then removing all of the jar entries
under the "Classpath" tab. This will ensure that you only get access to
Android's core libraries and not those from your desktop VM.

From the project's root directory...

Repeat these steps after each sync...

1) make (to proce generated .java source)
2) development/tools/idegen/idegen.sh
3) Open android.ipr in IntelliJ. If you already have the project open,
hit the sync button in IntelliJ, and it will automatically detect the
updated configuration.

If you get unexpected compilation errors from IntelliJ, try running
"Build -> Rebuild Project". Sometimes IntelliJ gets confused after the
project changes significantly.

If you』re using Eclipse…
If this is your first time using IDEGen...

Edit eclipse.ini ("Eclipse.app/Contents/MacOS/eclipse.ini" on OS X) and
add "-Xms748m -Xmx748m" to your VM options.

Configure a JRE named "1.5 (No Libraries)" under "Preferences -> Java ->
Installed JREs". Remove all of the jar entries underneath "JRE system
libraries". Eclipse will not let you save your configuration unless at
least one jar is present, so include a random jar that won't get in the
way.

From the project's root directory...

Repeat these steps after each sync...

1) make (to proce generated .java source)
2) development/tools/idegen/idegen.sh
3) Import the project root directory into your Eclipse workspace. If you
already have the project open, simply refresh it (F5).

Excluding source roots and jars
IDEGen keeps an exclusion list in the "excluded-paths" file. This file
has one regular expression per line that matches paths (relative to the
project root) that should be excluded from the IDE configuration. We
use Java's regular expression parser (see java.util.regex.Parser).

You can create your own additional exclusion list by creating an
"excluded-paths" file in the project's root directory. For example, you
might exclude all apps except the Browser in your IDE configuration with
this regular expression: "^packages/apps/(?!Browser)".

Controlling source root ordering (Eclipse)
You may want some source roots to come before others in Eclipse. Simply
create a file named "path-precedence" in your project's root directory.
Each line in the file is a regular expression that matches a source root
path (relative to the project's root directory). If a given source root's
path matches a regular expression that comes earlier in the file, that
source root will come earlier in the generated configuration. If a source
root doesn't match any of the expressions in the file, it will come last,
so you effectively have an implicit ".*" rule at the end of the file.

For example, if you want your applications's source root to come first,
you might add an expression like "^packages/apps/MyApp/src$" to the top
of the "path-precedence" file. To make source roots under ./out come last,
add "^(?!out/)" (which matches all paths that don't start with "out/").

熱點內容
存儲過程定義多個變數 發布:2024-04-24 09:04:13 瀏覽:761
為什麼安卓手機不值錢 發布:2024-04-24 09:02:40 瀏覽:99
拱度計演算法 發布:2024-04-24 08:53:09 瀏覽:289
windowsefs加密 發布:2024-04-24 08:51:30 瀏覽:878
英雄聯盟和飢荒哪個配置要求更高 發布:2024-04-24 07:55:09 瀏覽:604
linuxcpu佔用進程 發布:2024-04-24 07:37:05 瀏覽:120
河南移動鶴壁dns伺服器地址 發布:2024-04-24 07:36:58 瀏覽:594
百度賬號密碼怎麼設置密碼 發布:2024-04-24 07:27:37 瀏覽:759
cf窗口化源碼 發布:2024-04-24 07:04:33 瀏覽:738
linuxi2c設備 發布:2024-04-24 06:53:50 瀏覽:346