Cov txheej txheem:

Kuv yuav muab gradle dependencies nyob qhov twg?
Kuv yuav muab gradle dependencies nyob qhov twg?

Video: Kuv yuav muab gradle dependencies nyob qhov twg?

Video: Kuv yuav muab gradle dependencies nyob qhov twg?
Video: Yuav muab koj nco mus tag sim neej 2 7/18/2018 2024, Kaum ib hlis
Anonim

Rau ntxiv a kev vam khom rau koj qhov project, qhia a kev vam khom configuration xws li kev siv nyob rau hauv lub kev vam khom thaiv koj lub tsev. qib ntaub ntawv. Qhov no tshaj tawm tias a kev vam khom ntawm lub tsev qiv ntawv hauv Android lub npe hu ua "mylibrary" (lub npe no yuav tsum phim lub tsev qiv ntawv lub npe uas tau hais tseg nrog rau: hauv koj qhov chaw. qib ntaub ntawv).

Tsis tas li ntawd, kuv yuav ua li cas tswj cov gradle dependencies?

Cov kauj ruam los ntawm kauj ruam los tswj kev vam meej

  1. Tsim ib txoj haujlwm tshiab hauv Studio nrog Kotlin DSL ua cov ntawv tsim.
  2. Tsim ib lub nplaub tshev tshiab hu ua buildSrc nyob rau hauv lub ntsiab nplaub tshev ntawm qhov project.
  3. Hauv buildSrc ntxiv ob peb folders thiab cov ntaub ntawv, yog li cov qauv yog raws li nram no:
  4. Ntxiv Kotlin DSL plugin hauv cov ntaub ntawv build.gradle.kts:

Dab tsi yog qhov kev vam meej hauv gradle? Kev tshaj tawm. Gradle tsim tsab ntawv txhais cov txheej txheem los tsim cov haujlwm; txhua qhov project muaj qee qhov kev vam khom thiab qee qhov kev tshaj tawm. Kev vam meej txhais tau tias cov khoom uas txhawb nqa los tsim koj qhov project xws li xav tau JAR cov ntaub ntawv los ntawm lwm cov haujlwm thiab JARs sab nraud xws li JDBC JAR lossis Eh-cache JAR hauv chav kawm.

Yog li ntawd, kuv yuav ua li cas rub tawm gradle dependencies?

Download tau tus kev vam khom (thiab lawv kev vam khom ) mus rau hauv lub nplaub tshev runtime thaum koj ua qib getDeps cov. Rau Intellij mus saib > Tool Windows > Gradle > Refresh Txhua Qhov Haujlwm (cov ntawv xiav ncig ntawm sab saum toj ntawm lub Gradle qhov rai.

Kuv yuav import gradle dependencies rau hauv IntelliJ li cas?

Thaum twg kev import ib yam uas twb muaj lawm Gradle qhov project (ib qho nrog kev tsim. qib ) hauv IntelliJ IDEA, thaum nthuav tawm nrog lub vijtsam hauv qab no, xaiv Ntshuam los ntawm tus qauv sab nraud -> Gradle . Optionally, xaiv Auto Ntshuam ntawm qhov screen tom ntej kom tau txais ntshuam tshiab kev vam khom.

Pom zoo: