Android studio 添加引用Module项目 与 设置Module项目的Libs的Jar在主项目里使用

前言

 

添加引用Module项目

 

 

 

 

 

 

设置Module项目的Libs的Jar在主项目里使用

1.在项目里添加libs包,并且加入jar

Android studio 添加引用Module项目 与 设置Module项目的Libs的Jar在主项目里使用_第1张图片

 

2.设置这个module项目的build.gradle

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    api files('libs/xxxxxxxx.1.0_L.jar') //关键点 api files
}

这样就可以在主项目上使用这个jar包了,而不是jar只局限在这个module项目里

 

 

你可能感兴趣的:(Android studio 添加引用Module项目 与 设置Module项目的Libs的Jar在主项目里使用)