Android Studio project will be packaged into moudle aar aar file and modify

In the android development, we sometimes need to be a project as a dependency, and can use their resource files and interfaces, this time on the need to moudle we created aar file packaged into a specific package as follows:

Moudle packaged into the package aar

1, create a moudle

2, modified in moudle build.gradle file , which will be modified to com.android.application com.android.library , and applicationId "demo.com.ruite.mymoudle" delete this line

before fixing:


Modified:


 3, compile our Module , generate release version of aar, do not pay attention to is the debug version,

Click on the far right gradle panel, select our module to compile, CommandLine command to Assemble (default generate debug and release)

4, build under the View module / output folder, you can see the generated aar file, we generally use the release version of the file to aar

 

The introduction of a local project file aar

1. Copy the local aar file to the project in the lib

2. Modify build.gradle file, note that not project the build.gradle file, the file is moudle of build.gradle


3. Add the contents shown in FIG.

To be added as follows:

repositories  {
    flatDir{ dirs 'libs'  }
}

implementation(name:'mymoudle', ext:'aar')
至此,aar文件添加到项目完成引入

aar 文件修改

 aar 文件,有时第三方提供的SDK 是 aar格式,但有时也需要修里面的东西,如果直接解压,放上去无法识别。

正确打开方式,不要解压,以解压方式打,如果要删除某个文件直接删除,如果要修改某个或增加,可以直接拖入。这样可以正常使用,如果解压了就无法正常使用。

如上图,可以选择文件直接删除,或拖放直接增加或修改。 

Guess you like

Origin blog.csdn.net/P876643136/article/details/90648204