HighCapable / YukiHookAPI

⛱️ An efficient Hook API and Xposed Module solution built in Kotlin.
https://highcapable.github.io/YukiHookAPI/
Apache License 2.0
1.42k stars 105 forks source link

构建时报错找不到ksp #73

Closed Doratmon closed 6 months ago

Doratmon commented 6 months ago

按照文档配置项目,报错如下:

Plugin [id: 'com.google.devtools.ksp', version: '1.7.20-1.0.8'] was not found in any of the following sources
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.7.20-1.0.8')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
MavenRepo (3 s 807 ms)

所使用的配置文件如下: build.gradle(app)

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    // 作为 Xposed 模块使用务必添加,其它情况可选
    id 'com.google.devtools.ksp' version '1.7.20-1.0.8'
}

android {
    namespace 'com.example.yukihookdemo'
    compileSdk 32

    defaultConfig {
        applicationId "com.example.yukihookdemo"
        minSdk 24
        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_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // 基础依赖
    implementation 'com.highcapable.yukihookapi:api:1.2.0'
    // 作为 Xposed 模块使用务必添加,其它情况可选
    compileOnly 'de.robv.android.xposed:api:82'
    // 作为 Xposed 模块使用务必添加,其它情况可选
    ksp 'com.highcapable.yukihookapi:ksp-xposed:1.2.0'
}

build.gradle(project)

plugins {
    id 'com.android.application' version '7.3.1' apply false
    id 'com.android.library' version '7.3.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}

settings.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        // 作为 Xposed 模块使用务必添加,其它情况可选
        maven { url 'https://api.xposed.info/' }
        // MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
        maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
    }
}
rootProject.name = "YukiHookDemo"
include ':app'

对于gradle我不是很熟悉,具体的配置也参考了一些使用YukiHookAPI的其他项目,如 MiFreeFormX,但问题依旧没解决,感谢任何的帮助🙏。

fankes commented 6 months ago

依赖太老了,请参考 README 中的文档以节省你提问的宝贵时间