<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                經過兩個多月的AS體驗,我認為是時候將Android的開發環境遷移到AS上了。目前最新版本是1.0.2(大年30當天升級到1.1.0),除了UI控件拖拽偶爾崩潰的問題(Ubuntu),其他功能用來還是十分流暢和高效。打動我的有如下幾個特色: * 智能感知體驗特好,堪比VS * 布局預覽,手寫布局后預覽頁面即時顯示,便于布局調整和優化 * 編輯速度飛快流暢,毫無eclipse的卡頓 * 布局或源碼中有圖標和顏色的預覽,十分直觀 * 調試時體驗極佳 * 集成了Terminal,喜歡命令行操作的伙伴不用額外啟動終端了。 總之一句話,就是用起來特別爽! Android Studio 源于[IntelliJ IDEA](http://blog.csdn.net/lincyang/article/details/www.jetbrains.com/idea/ "IntelliJ IDEA")的社區版,構建工具是[Gradle](http://www.gradle.org/ "Gradle")這個下一代的構建工具,再加上Google為Android定制的一些工具,那么AS必然會成為Android開發工具的經典款。 ## Android Studio的安裝 Adnroid官網上不去,我們可以到其他[網站下載](http://www.android-studio.org/index.php/88-download/ "AS download")AS,然后再升級到1.0.2。? AS對系統的要求不低,不過我這i7處理器+8G內存還是毫無壓力啊。 Windows ~~~ Microsoft? Windows? 8/7/Vista/2003 (32 or 64-bit) 2 GB RAM minimum, 4 GB RAM recommended 400 MB hard disk space At least 1 GB for Android SDK, emulator system images, and caches 1280 x 800 minimum screen resolution Java Development Kit (JDK) 7 Optional for accelerated emulator: Intel? processor with support for Intel? VT-x, Intel? EM64T (Intel? 64), and Execute Disable (XD) Bit functionality ~~~ Mac OS X ~~~ Mac? OS X? 10.8.5 or higher, up to 10.9 (Mavericks) 2 GB RAM minimum, 4 GB RAM recommended 400 MB hard disk space At least 1 GB for Android SDK, emulator system images, and caches 1280 x 800 minimum screen resolution Java Runtime Environment (JRE) 6 Java Development Kit (JDK) 7 Optional for accelerated emulator: Intel? processor with support for Intel? VT-x, Intel? EM64T (Intel? 64), and Execute Disable (XD) Bit functionality ~~~ On Mac OS, run Android Studio with Java Runtime Environment (JRE) 6 for optimized font rendering. You can then configure your project to use Java Development Kit (JDK) 6 or JDK 7.? Linux ~~~ GNOME or KDE desktop GNU C Library (glibc) 2.11 or later 2 GB RAM minimum, 4 GB RAM recommended 400 MB hard disk space At least 1 GB for Android SDK, emulator system images, and caches 1280 x 800 minimum screen resolution Oracle? Java Development Kit (JDK) 7 ~~~ 下載后將其解壓到你指定的路徑。我在Ubuntu下工作,就直接將其放到/opt下了。解壓后內容如下: ~~~ android-studio3$ ls bin build.txt gradle Install-Linux-tar.txt lib license LICENSE.txt NOTICE.txt plugins ~~~ 值得一說的是,gradle就在這里,一會兒我們可以直接用gradle去做簡單的編譯工作。首先,我們要執行bin下的studio.sh啟動AS,就像Install-Linux-tar.txt中說的,我們可以將這個bin目錄放到系統變量中,以后啟動AS只需輸入studio.sh即可。比如我在.bashrc中添加如下內容: ~~~ export PATH="$PATH:/opt/android-studio3/bin" export PATH="$PATH:/opt/android-studio3/gradle/gradle-2.2.1/bin" ~~~ 首次啟動會檢測sdk并升級到最新,如果不用代理,這一步我們無法通過,AS就不會啟動成功。解決辦法就是將自己的Adnroid SDK Manager配好代理到國內的鏡像,請參照[《Android實戰技巧之九:最新Android開發環境(Eclipse+ADT+Android 5.0) 》](http://blog.csdn.net/lincyang/article/details/42029257 "eclipse adt"),順利通過升級后,AS會成功啟動。后面的事情就簡單了,界面清晰明了,就像你用其他IDE一樣,上手很快。但是項目結果變化很大(與Eclipse相比),快捷鍵變化也很大,都要適應一段時間。下載一份[Keymap](https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf "keymap")打印出來,用到了就看看,會很快進入狀態。 Tips:? 打開項目后修改sdk和jdk路徑,設置如下:File –>Other Settings –>Default project Structure? 如果你喜歡黑色風格的主題,那么切換到吸血鬼Darcula主題是個不錯的選擇:File–>Settings–>Appearance–>Theme ## Gradle 項目中有兩個build.gradle文件,如下: ~~~ $ find -name build.gradle ./app/build.gradle ./build.gradle ~~~ 項目根目錄下的build.gradle只做了比較commen的配置,app下的build.gradle是針對此app更細致的配置: ~~~ apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.linc.arrowfall" minSdkVersion 17 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' } ~~~ Make Project(Ctrl+F9)時,右下角Gradle Console就會打印如下信息: ~~~ Executing tasks: [:app:compileDebugSources] Configuration on demand is an incubating feature. :app:preBuild :app:preDebugBuild :app:checkDebugManifest :app:preReleaseBuild :app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJava :app:compileDebugNdk :app:compileDebugSources BUILD SUCCESSFUL Total time: 10.23 secs ~~~ 先放下AS中的Gradle,我們先從Gradle命令行說起。剛剛提到AS中自帶的Gradle路徑在android-studio3/gradle/gradle-2.2.1/bin下,將其加入到環境變量(如上),這樣在如何位置都可以使用gradle工具了。下面來作一下gradle最簡單的使用: ~~~ $ gradle -v ------------------------------------------------------------ Gradle 2.2.1 ------------------------------------------------------------ Build time: 2014-11-24 09:45:35 UTC Build number: none Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a Groovy: 2.3.6 Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 JVM: 1.7.0_71 (Oracle Corporation 24.71-b01) OS: Linux 3.13.0-45-generic amd64 ~~~ gradle是正常工作了,下面來個hello world吧。新建一個build.gradle文件,加入如下代碼: ~~~ task helloworld << { println 'hello world' } ~~~ 這個task只輸出一條log,執行如下命令: ~~~ $ gradle -q helloworld hello world ~~~ 參數-q只是打印log,這個task也就是此功能而已。? 在此目錄下執行gradle –gui,調出圖形界面的gradle,看看helloworld的其他信息。 **編譯Java程序**? 現在嘗試編譯一個最簡單的Java程序,在剛剛的目錄下新建目錄和文件如下: ~~~ $ mkdir -p src/main/java/com/linc; vim src/main/java/com/linc/HelloWorld.java ~~~ 代碼內如如下: ~~~ package com.linc; public class HelloWorld { public static void main(String args[]) { System.out.println("hello, world"); } } ~~~ build.gradle文件與src目錄平級,內如只有一行: ~~~ apply plugin: 'java' ~~~ 此時運行**gradle build**: ~~~ $ gradle build :compileJava :processResources UP-TO-DATE :classes :jar :assemble :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build BUILD SUCCESSFUL Total time: 2.206 secs ~~~ 此時的目錄結構變為如下所示: ~~~ $ tree -L 6 . ├── build │ ├── classes │ │ └── main │ │ └── com │ │ └── linc │ │ └── HelloWorld.class │ ├── dependency-cache │ ├── libs │ │ └── helloworld.jar │ └── tmp │ ├── compileJava │ └── jar │ └── MANIFEST.MF ├── HelloWorld.java └── src └── main └── java └── com └── linc └── HelloWorld.java ~~~ 運行編譯好的java程序: ~~~ $ java -cp build/classes/main/ com.linc.HelloWorld hello, world ~~~ Gradle的初體驗就到這里,更復雜的構建任務還在后頭。有了AS這個強大的工具,Android開發會變得越來越有樂趣! * * * 參考: [http://www.gradle.org/documentation](http://www.gradle.org/documentation)? [http://www.android-studio.org/index.php/88-download/](http://www.android-studio.org/index.php/88-download/)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看