matrix icon indicating copy to clipboard operation
matrix copied to clipboard

最新AndroidStudio如何gradle如何配置matrix啊?

Open EvenDai opened this issue 8 months ago • 3 comments

救命啊,现在最新Android Studio的配置已经发生翻天覆地的变化了,官方能不能给最新的gradle版本如何配置Matrix给更新一下啊,这东西,问DeepSeek根本没有用,实现是解决不了,头痛!

我目前的Android Studio版本为:Android Studio Meerkat | 2024.3.1

现在项目根目录中的settings.gradle.kts是这样的:

pluginManagement {
    repositories {
        google {
            content {
                includeGroupByRegex("com\\.android.*")
                includeGroupByRegex("com\\.google.*")
                includeGroupByRegex("androidx.*")
            }
        }
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "MatrixDemo"
include(":app")

根目录的build.gradle.kts是这样的:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
}

app模块的build.gradle.kts是这样的:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
}

android {
    namespace = "cn.android666.matrixdemo"
    compileSdk = 35

    defaultConfig {
        applicationId = "cn.android666.matrixdemo"
        minSdk = 24
        targetSdk = 35
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
    }
}

dependencies {
    val matrixVersion = "2.1.0"
    implementation("com.tencent.matrix:matrix-android-lib:$matrixVersion")
    implementation("com.tencent.matrix:matrix-trace-canary:$matrixVersion")
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    implementation(libs.androidx.activity)
    implementation(libs.androidx.constraintlayout)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
}

现在只会配置依赖,但是那个插件是如何配置的,真是搞不明白了,官方的插件配置代码是这样的:

dependencies {
      classpath ("com.tencent.matrix:matrix-gradle-plugin:${MATRIX_VERSION}") { changing = true }
}
apply plugin: 'com.tencent.matrix-plugin'
  matrix {
    trace {
        enable = true	//if you don't want to use trace canary, set false
        baseMethodMapFile = "${project.buildDir}/matrix_output/Debug.methodmap"
        blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt"
    }
}

现在这两项要怎么写了,对gralde不是很了解,百度、DeepSeek根本找不到答案了,怎么改怎么出错,头疼!

EvenDai avatar May 27 '25 14:05 EvenDai

我也是 哈哈 完全没法接入 @EvenDai

rcj60560 avatar Jul 04 '25 04:07 rcj60560

8.0的gradle根本不行,方法都改了

zhangsan98k avatar Jul 15 '25 09:07 zhangsan98k

所以gradle8以上就用不了这个插件是么

wakakamoymoy-art avatar Nov 03 '25 02:11 wakakamoymoy-art