一、导到入项目根目录build.gradle的android插件依赖到app/build.gradle中
// Top-level build file where you can add configuration options common to all sub-projects/modules.
task assemble {}
buildscript {
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
把 classpath 'com.android.tools.build:gradle:8.0.0' 这个编译插件
写在app/build.gradle的依赖里面
apply plugin: 'com.android.application'
android {
compileSdkVersion ANDROID_BUILD_SDK_VERSION as int
defaultConfig {
minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION as int
targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION as int
versionCode VERSION_CODE as int
versionName VERSION_NAME
}
signingConfigs {
signing
}
buildTypes {
release {
}
}
}
dependencies {
implementation 'com.android.tools.build:gradle:8.0.0'
}
二、把 gradle版本的工程jar包导入到app/src/libs目录下
去找到gradle框架主库的缓存,我的是在路径
C:\Users\Administrator\.gradle\wrapper\dists\gradle-8.0-bin\ca5e32bp14vu59qr306oxotwh\gradle-8.0
如图所示,找到之后。
把所有jar包拷贝出来,包括plugins目录下的jar包,一起复制到app/src/lib目录下面,注意要放到一级目录libs下,不要有文件夹。
sync一下gradle,就可以看gradle包括android插件的所有项目源码了。你学会了吗?
gradle相关的依赖就导入了项目中
就可以愉快地查看源码了,索引基本都在,都可以索引到打开