Comments (5)
import 不能去掉的,颜色置灰 和 无法跳转等问题,是本地应该没有正常编译通过,编译通过之后就都正常了
from composingbuilds-vs-buildsrc.
编译过程没有出现异常提示 build success
plugin-version ------ build.gradle
plugins {
id('java-gradle-plugin')
id('org.jetbrains.kotlin.jvm') version '1.6.10'
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
//添加Gradle相关的API,否则无法自定义Plugin和Task
implementation(gradleApi())
implementation('org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10')
}
gradlePlugin {
plugins {
version {
//添加插件
id ='com.hi.dhl.plugin'
//在根目录创建类 VersionPlugin 继承 Plugin<Project>
implementationClass = 'com.hi.dhl.plugin.VersionPlugin'
}
}
}
根路径下build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'com.hi.dhl.plugin' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app modle--build.gradle
// 1. 导入plugin-version 依赖类
import com.hi.dhl.plugin.*
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.hi.dhl.plugin'
}
android {
compileSdk BuildConfig.compileSdkVersion
defaultConfig {
applicationId BuildConfig.applicationId
minSdk BuildConfig.minSdkVersion
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
setting.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Test2"
include ':app'
includeBuild('plugin-version')
点击plugin可以跳转,但引用的位置点击not foud
from composingbuilds-vs-buildsrc.
我导入运行你的项目,可以正常跳转引用,但如果把
gradle 升级到7.3.3(distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip),
kotlin 升级到1.6.10(ext.kotlin_version = "1.6.10")
后,虽然编译运行正常,也不能正常的跳转引用了。
from composingbuilds-vs-buildsrc.
需要跳转引用,代码提示:将build.gradle 升级成 build.gradle.kts
@tudoutiao
环境:
gradle 7.2.1. kotlin 1.6.10
from composingbuilds-vs-buildsrc.
我导入运行你的项目,可以正常跳转引用,但如果把
gradle 升级到7.3.3(distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip), kotlin 升级到1.6.10(ext.kotlin_version = "1.6.10")
后,虽然编译运行正常,也不能正常的跳转引用了。
https://github.com/hi-dhl/Binding 这个库,我将 AGP 升级到 7x , kotlin 升级到了 1.6.10 ,可以参考一下
from composingbuilds-vs-buildsrc.
Related Issues (12)
- Unresolved reference: Plugin HOT 1
- 可以放在同一目录 HOT 1
- 一定要用dsl吗,用apply plugin会提示id找不到,用plugin{},无论放哪都会提示位置错误 HOT 2
- ComposingBuild的项目在AS中make project报错 HOT 8
- 使用Composing builds的缓存问题 HOT 4
- ComposingBuilds缺点补充 HOT 48
- 是否有方法可以统一为每个模块引入插件 HOT 4
- VersionPlugin放外面,多项目引用的问题 HOT 1
- composing-build文件夹存放问题[讨论] HOT 6
- 依赖库提示更新的问题 HOT 2
- common_config.gradle添加的时候出现问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composingbuilds-vs-buildsrc.