在Android項目中使用OKHttp3怎么實現(xiàn)一個下載功能-創(chuàng)新互聯(lián)

這篇文章給大家介紹在Android項目中使用OKHttp3怎么實現(xiàn)一個下載功能,內(nèi)容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

成都創(chuàng)新互聯(lián)公司專注于高平網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供高平營銷型網(wǎng)站建設(shè),高平網(wǎng)站制作、高平網(wǎng)頁設(shè)計、高平網(wǎng)站官網(wǎng)定制、微信小程序開發(fā)服務(wù),打造高平網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供高平網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

app Module下的build.gradle,代碼如下

apply plugin: 'com.android.application' 
 
android { 
  compileSdkVersion 24 
  buildToolsVersion "24.0.3" 
 
  defaultConfig { 
    applicationId "com.lanou3g.downdemo" 
    minSdkVersion 15 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    //為了開啟Java8 
    jackOptions{ 
      enabled true; 
    } 
  } 
  buildTypes { 
    release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
  } 
 
  //開啟Java1.8 能夠使用lambda表達式 
  compileOptions{ 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
  } 
} 
 
dependencies { 
  compile fileTree(dir: 'libs', include: ['*.jar']) 
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
  }) 
  compile 'com.android.support:appcompat-v7:24.1.1' 
  testCompile 'junit:junit:4.12' 
 
  //OKHttp 
  compile 'com.squareup.okhttp3:okhttp:3.6.0' 
  //RxJava和RxAndroid 用來做線程切換的 
  compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 
  compile 'io.reactivex.rxjava2:rxjava:2.0.1' 
} 

新聞標(biāo)題:在Android項目中使用OKHttp3怎么實現(xiàn)一個下載功能-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://bm7419.com/article28/dsdjcp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機網(wǎng)站建設(shè)網(wǎng)站策劃、靜態(tài)網(wǎng)站、自適應(yīng)網(wǎng)站、面包屑導(dǎo)航網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計