国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Android Studio使用心得

說(shuō)實(shí)話 開(kāi)始接觸這個(gè)工具 真的覺(jué)得很惡心 畢竟大陸被墻  很多東西用起來(lái)不是很方便 而且Eclipse轉(zhuǎn)到Android Studio還是一個(gè)跨度 廢話不多說(shuō)  下面 講下我遇到的問(wèn)題

1. 安裝的時(shí)候(Setup Wizard - Download Components) 這個(gè)要下載很長(zhǎng)時(shí)間 甚至下載不了 (PS: 這個(gè)選擇并下載2.25G的組件是studio的一個(gè)bug,評(píng)論里有人提醒,感謝這位同學(xué)。如果網(wǎng)速不行想跳過(guò)這步的可以在bin目錄的idea.properties增加一行:disable.android.first.run=true就行了,mac平臺(tái)的右鍵安裝包->Show Package Contents 就找到bin目錄了。)

 

2.新建項(xiàng)目成功后會(huì)下載Gradle,貌似這個(gè)過(guò)程不翻墻也是可以下載,但是訪問(wèn)特別慢,建議翻墻下載。那么下載的Gradle到什么地方呢?  打開(kāi)C:\Users\Administrator\.gradle\wrapper\dists\gradle-1.10-all\d90a2yjknzzhpcfgm937zpcte 你會(huì)看到需要的gradle版本 例如我的是gradle-1.10 我會(huì)去百度上搜這個(gè)下載 一大堆 下載之后把gradle-1.10-all.zip復(fù)制到此目錄下(C:\Users\Administrator\.gradle\wrapper\dists\gradle-1.10-all\d90a2yjknzzhpcfgm937zpcte)

 

注:如果是導(dǎo)入一個(gè)項(xiàng)目一直處于Building 那么去修改項(xiàng)目Gradle目錄下的gradle-wrapper.properties 文件里邊的distributionUrl 最后邊改成已經(jīng)下載的gradle版本例如 我已經(jīng)有g(shù)radle-2.2.1-all.zip 但是沒(méi)有g(shù)radle-2.4-all.zip的 所以我會(huì)改成distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

 

如果導(dǎo)入項(xiàng)目之后 下載Android studio那么結(jié)束掉任務(wù) 去修改項(xiàng)目根目錄下的build.gradle
改成你現(xiàn)在的版本

 dependencies {
        classpath 'com.android.tools.build:gradle:1.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

 

 

3. 關(guān)于build.gradle的配置:

   主工程app:

    apply plugin: 'com.android.application'  表示申明此工程為主工程

 

 dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])  默認(rèn)不需要多解釋

compile project(':StudioKlowerBase')}  申明主工程依賴的Library 注意拼寫(xiě)規(guī)則, 名字要與你的Library名字一樣

 

buildTypes {    release {        minifyEnabled true(表示打包簽名的時(shí)候 是正式包 會(huì)執(zhí)行混淆代碼) 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      定義代碼混淆文件 注意:proguard-rules.pro要放在主工程的目錄下
    }}
完整代碼如下:
  1. apply plugin: 'com.android.application'  
  2.   
  3. android {  
  4.     compileSdkVersion 19  
  5.     buildToolsVersion "19.1.0"  
  6.   
  7.     defaultConfig {  
  8.         applicationId "com.klowerbase.test"  
  9.         minSdkVersion 11  
  10.         targetSdkVersion 19  
  11.         versionCode 1  
  12.         versionName "1.0"  
  13.     }  
  14.     buildTypes {  
  15.         release {  
  16.             minifyEnabled true  
  17.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
  18.         }  
  19.     }  
  20. }  
  21.   
  22. dependencies {  
  23.     compile fileTree(dir: 'libs', include: ['*.jar'])  
  24.   
  25.     compile project(':StudioKlowerBase')  
  26. }  

--Library 工程的配置
apply plugin: 'android-library'定義為L(zhǎng)ibrary
dependencies {    classpath 'com.android.tools.build:gradle:1.2.2' 定義編譯的gradle版本
 }
完整代碼如下:
  1. buildscript {  
  2.     repositories {  
  3.         mavenCentral()  
  4.     }  
  5.     dependencies {  
  6.         classpath 'com.android.tools.build:gradle:1.2.2'  
  7.     }  
  8. }  
  9. apply plugin: 'android-library'  
  10.   
  11. dependencies {  
  12.     compile fileTree(include: '*.jar', dir: 'libs')  
  13. }  
  14.   
  15. android {  
  16.     compileSdkVersion 19  
  17.     buildToolsVersion "19.1.0"  
  18.   
  19.     sourceSets {  
  20.         main {  
  21.             manifest.srcFile 'AndroidManifest.xml'  
  22.             java.srcDirs = ['src']  
  23.             resources.srcDirs = ['src']  
  24.             aidl.srcDirs = ['src']  
  25.             renderscript.srcDirs = ['src']  
  26.             res.srcDirs = ['res']  
  27.             assets.srcDirs = ['assets']  
  28.         }  
  29.   
  30.         // Move the tests to tests/java, tests/res, etc...  
  31.         instrumentTest.setRoot('tests')  
  32.   
  33.         // Move the build types to build-types/<type>  
  34.         // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...  
  35.         // This moves them out of them default location under src/<type>/... which would  
  36.         // conflict with src/ being used by the main source set.  
  37.         // Adding new build types or product flavors should be accompanied  
  38.         // by a similar customization.  
  39.         debug.setRoot('build-types/debug')  
  40.         release.setRoot('build-types/release')  
  41.     }  
  42. }  

項(xiàng)目的配置 代碼如下
  1. // Top-level build file where you can add configuration options common to all sub-projects/modules.  
  2.   
  3. buildscript {  
  4.     repositories {  
  5.         jcenter()  
  6.     }  
  7.     dependencies {  
  8.         classpath 'com.android.tools.build:gradle:1.2.2'  
  9.   
  10.         // NOTE: Do not place your application dependencies here; they belong  
  11.         // in the individual module build.gradle files  
  12.     }  
  13. }  
  14.   
  15. allprojects {  
  16.     repositories {  
  17.         jcenter()  
  18.     }  
  19. }  
  1.    
  1. 解決Task '' not found in root project '***'.  
  2. 方法1:刪掉.iml里的<component name="FacetManager"> ... </component>  
  3. 方法2:刪掉.iml跟.idea文件夾 重新導(dǎo)入程序  
  4. 經(jīng)過(guò)實(shí)驗(yàn):第二種方法 有效  
  5. 由于我用的gradle-2.2.1 項(xiàng)目結(jié)構(gòu)有些變化,如下截圖:  
  1. <img src="http://img.blog.csdn.net/20150720130051120?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />  

最后在附上一些常用的快捷鍵:

Ctrl+Alt+L  格式化代碼

Ctrl+Alt+space 代碼提示

Ctrl+Alt+O 優(yōu)化導(dǎo)入的類和包

Alt+Insert 生成代碼(如get,set方法,構(gòu)造函數(shù)等)

Ctrl+Shift+Space 自動(dòng)補(bǔ)全代碼

Ctrl+空格 代碼提示

Ctrl+R 替換

Ctrl+Y 刪除行(ctrl+x不是刪除行,是剪切。如果不選中,則為剪切當(dāng)行。ths for 貌似掉線)Ctrl+D 復(fù)制行Ctrl+/ 或 Ctrl+Shift+/  注釋(// 或者/*...*/ )

 

 

 

 

 

 

 

 

 

 

 

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
用vscode搭建原生app開(kāi)發(fā)環(huán)境
Android Studio常用Gradle操作
使用Gradle構(gòu)建Android項(xiàng)目
用Gradle 構(gòu)建你的android程序
gradle 詳解
Android Studio導(dǎo)入第三方類庫(kù)的方法
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服