3

デバッグ アイコンをタップすると、Android Studio が自動的に新しいBuildConfigファイルを作成し、名前が 1 つだけである必要があると不平を言うことがありますBuildconfig.java...

ここに画像の説明を入力

AClean Projectはそれを修正しますが、信頼できる解決策がなければならないほど面倒です。

前もって感謝します

編集:

私のbuild.gradleファイル:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

私のbuild.gradle(Module: app)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "de.my.app.id"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.navigation:navigation-fragment:2.2.2'
    implementation 'androidx.navigation:navigation-ui:2.2.2'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.github.RobertApikyan:SegmentedControl:1.2.0'
    implementation 'androidx.viewpager2:viewpager2:1.0.0'
    implementation 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:1.0.0'
}

編集: ビルドおよびデバッグすると、コンソールに次のエラー警告が表示されます:

このビルドでは非推奨の Gradle 機能が使用されていたため、Gradle 7.0 との互換性がありません。'--warning-mode all' を使用して、個々の非推奨警告を表示します。https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warningsを参照してください

4

1 に答える 1