简体   繁体   English

错误:(134, 0) 无法为 org.gradle.api.internal.FactoryNamedDomainObjectContainer 类型的 SigningConfig 容器获取未知属性“释放”。

[英]Error:(134, 0) Could not get unknown property 'release' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.

I'm trying to modify an open source code in android studio, but I keep getting Error:(134, 0) Could not get unknown property 'release' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.我正在尝试修改 android 工作室中的开源代码,但我不断收到错误消息:(134, 0) 无法为 org.gradle.Z8A5DA52ED126447D3A8Container.internal.Factory 类型的 SigningConfig 容器获取未知属性“释放”。 Does anyone know what's wrong with the code?有谁知道代码有什么问题? The code in the build.gradle file is posted below. build.gradle 文件中的代码发布在下面。

//apply plugin: 'idea'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {

    // Create a variable called keystorePropertiesFile, and initialize it to your
    // keystore.properties file, in the rootProject folder.
    def keystorePropertiesFile = rootProject.file("keystore.properties")
    if (keystorePropertiesFile.exists()) {
        Properties keystoreProperties = new Properties();
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))



    compileSdkVersion 27
    buildToolsVersion "$supportLibraryVersion"
    defaultConfig {
        applicationId "org.bottiger.podcast"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 424        // even - release. Odd - development
        versionName "0.160.2" // even - release. Odd - development
        multiDexEnabled = true

        vectorDrawables.useSupportLibrary = true

        // Espresso
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                cppFlags "-std=c++11"
                arguments '-DANDROID_PLATFORM=android-16', '-DANDROID_TOOLCHAIN=clang'
            }
        }
    }
    dataBinding {
        enabled = true
    }
    // Point Gradle at the directory where you want to root all of your native code
    // There is a default directory but I prefer to control which directories to use
    // and there will be a point later where keeping control over this is important
    sourceSets.main {
        jni.srcDirs = ["src/main/jni"];
        java.srcDirs += 'src/main/kotlin'

    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'LICENSE.txt'
        exclude 'META-INF/rxjava.properties'
    }

    flavorDimensions "default"

    productFlavors {

        dev {
            // To avoid using legacy multidex when building from the command line,
            // set minSdkVersion to 21 or higher. When using Android Studio 2.3 or higher,
            // the build automatically avoids legacy multidex when deploying to a device running
            // API level 21 or higher—regardless of what you set as your minSdkVersion.
            minSdkVersion 21
            versionNameSuffix "-dev"
            //applicationIdSuffix '.dev'

            // The following configuration limits the "dev" flavor to using
            // English stringresources and xxhdpi screen-density resources.
            resConfigs "en", "xxhdpi"

            buildConfigField "boolean", "DEV_MODE", "true"
            buildConfigField "boolean", "PRIVATE_MODE", "false"
            buildConfigField "boolean", "LIBRE_MODE", "false"

            dimension "default"
        }

        free {
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }

            buildConfigField "boolean", "DEV_MODE", "false"
            buildConfigField "boolean", "PRIVATE_MODE", "true"
            buildConfigField "boolean", "LIBRE_MODE", "true"

            dimension "default"
        }

        google {
            buildConfigField "boolean", "DEV_MODE", "false"
            buildConfigField "boolean", "PRIVATE_MODE", "false"
            buildConfigField "boolean", "LIBRE_MODE", "false"

            dimension "default"
        }

        amazon {
            buildConfigField "boolean", "DEV_MODE", "false"
            buildConfigField "boolean", "PRIVATE_MODE", "false"
            buildConfigField "boolean", "LIBRE_MODE", "false"

            dimension "default"
        }
    }

        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }
        android.buildTypes.release.signingConfig = signingConfigs.release
    } else  {
        android.buildTypes.release.signingConfig = null
    }


    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release


        }
    }
    // http://stackoverflow.com/questions/22851103/android-studio-gradle-error-multiple-dex-files-define
    dexOptions {
        preDexLibraries true
        maxProcessCount 8
        javaMaxHeapSize "2g"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    // Encapsulates your external native build configurations.
    externalNativeBuild {

        // Encapsulates your CMake build configurations.
        cmake {
            // Provides a relative path to your CMake build script.
            path "src/main/cpp/CMakeLists.txt"
        }
    }
}

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

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.2'

    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    compile "com.android.support:support-v4:$supportLibraryVersion"
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
    compile "com.android.support:palette-v7:$supportLibraryVersion"
    compile "com.android.support:cardview-v7:$supportLibraryVersion"
    compile "com.android.support:mediarouter-v7:$supportLibraryVersion"
    compile "com.android.support:design:$supportLibraryVersion"
    compile "com.android.support:percent:$supportLibraryVersion"

    compile "android.arch.lifecycle:runtime:$architectureComponentsVersion"
    compile "android.arch.lifecycle:extensions:$architectureComponentsVersion"
    compile "android.arch.lifecycle:reactivestreams:$architectureComponentsVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$architectureComponentsVersion"
    compile "android.arch.persistence.room:runtime:$architectureComponentsVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$architectureComponentsVersion"
    compile "android.arch.persistence.room:rxjava2:$architectureComponentsVersion"

    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    compile "com.squareup.okhttp3:okhttp:$okhttp_version"
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile('com.googlecode.json-simple:json-simple:1.1.1') {
        exclude module: 'junit'
    }
    //compile 'com.google.apis:google-api-services-drive:+'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.3.0'

    compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.8'

    compile 'io.requery:sqlite-android:3.20.0'
    compile 'com.google.android.exoplayer:exoplayer:2.6.1'
    compile('com.wdullaer:materialdatetimepicker:3.1.1') {
        exclude group: 'com.android.support'
    }

    // Glide
    compile "com.github.bumptech.glide:glide:$glide_version"
    compile "com.github.bumptech.glide:okhttp3-integration:$glide_version"
    compile "com.github.bumptech.glide:compiler:$glide_version"
    compile "com.github.bumptech.glide:recyclerview-integration:$glide_version"
    annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

    compile 'net.steamcrafted:materialiconlib:1.1.2'
    compile 'org.whispersystems:libpastelog:1.0.7'
    compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
    compile 'com.google.http-client:google-http-client-gson:1.22.0'

    compile 'jp.wasabeef:recyclerview-animators:2.2.6'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.bugsnag:bugsnag-android:3.8.0'
    compile 'com.journeyapps:zxing-android-embedded:3.4.0'
    compile 'com.heinrichreimersoftware:material-intro:1.6.2'
    compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
    compile 'com.github.daniel-stoneuk:material-about-library:2.2.3-support26.1.0'
    compile 'org.unbescape:unbescape:1.1.4.RELEASE'
    compile 'com.google.dagger:dagger:2.10'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.10'

    compile project(':armv7-fmmr')
    // For testing only
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:2.7.19'
    testCompile("android.arch.persistence.room:testing:$architectureComponentsVersion") {
        exclude group: 'com.android.support'
        exclude group: 'com.google.code.gson'
    }

    configurations.all {
        resolutionStrategy.force "com.android.support:support-annotations:$supportLibraryVersion"
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'

        exclude group: "org.apache.httpcomponents", module: "httpclient"
    }
    // Espresso
    // https://developer.android.com/training/testing/ui-testing/espresso-testing.html
    androidTestCompile 'com.android.support.test:runner:1.0.1'
    androidTestCompile 'com.android.support.test:rules:1.0.1'
    androidTestCompile 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'
    androidTestCompile "com.squareup.okhttp3:okhttp:$okhttp_version"
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:$espressoVersion") {
        exclude group: 'com.android.support'
    }
    androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    // Free version
    // Amazon version
    amazonCompile fileTree(dir: 'src/amazon/libs', include: ['*.jar'])
    amazonCompile "com.google.android.gms:play-services-cast:$playServicesVersion"
    amazonCompile "com.google.android.gms:play-services-cast-framework:$playServicesVersion"
    amazonCompile "com.google.android.gms:play-services-auth:$playServicesVersion"
    amazonCompile "com.google.android.gms:play-services-location:$playServicesVersion"
    amazonCompile "com.google.firebase:firebase-messaging:$playServicesVersion"
    // google cast
    // Play Store
    googleCompile "com.google.android.gms:play-services-analytics:$playServicesVersion"
    // analytics
    googleCompile "com.google.android.gms:play-services-cast:$playServicesVersion"
    googleCompile "com.google.android.gms:play-services-cast-framework:$playServicesVersion"
    googleCompile "com.google.android.gms:play-services-auth:$playServicesVersion"
    googleCompile "com.google.android.gms:play-services-location:$playServicesVersion"
    googleCompile "com.google.firebase:firebase-core:$playServicesVersion"
    googleCompile "com.google.firebase:firebase-messaging:$playServicesVersion"
    googleCompile "com.google.firebase:firebase-database:$playServicesVersion"
    // google cast
    compile project(':soundwavescommon')
}

apply plugin: 'com.google.gms.google-services'

I was also facing the same issue.我也面临同样的问题。 In my case I just placed the signingConfigs{} above the buildTypes{}在我来说,我只是放在signingConfigs{}上述buildTypes{}

signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

I had the exact same issue while I was creating an APK with React Native.我在使用 React Native 创建 APK 时遇到了完全相同的问题。 It was solved changing the scope of signingConfigs.改变了signatureConfigs的范围已解决。

Source: https://github.com/researchgate/gradle-release/issues/187来源: https : //github.com/researchgate/gradle-release/issues/187

Please try the following 10 steps :请尝试以下 10 个步骤:

  1. Go to " Build " on the top panel of Android Studio.转到 Android Studio 顶部面板上的“构建”。
  2. Select " Edit Build Variant ".选择“编辑构建变体”。
  3. Go to " Modules "(on the left side).转到“模块”(在左侧)。
  4. Click "signin configs"点击“登录配置”
  5. Click on "+" sign, and type "release".单击“+”号,然后键入“release”。
  6. Click apply and ok单击应用并确定

After this please enter your keystore details,在此之后,请输入您的密钥库详细信息,

  1. go to " Build variants " on the same place in the left side.转到左侧同一位置的“构建变体”。
  2. Click on " release "点击“发布
  3. scroll down and go to " sign in config " and select " $signinConfig.release "向下滚动并转到“登录配置”并选择“ $signinConfig.release
  4. Click apply and Ok.单击应用和确定。

In my case (which was not in signingConfig block), I was using a property called release in a gradle file that was applied in my module gradle file.在我的情况下(不在signingConfig块中),我在gradle 文件中使用了一个名为release的属性,该属性应用于我的模块gradle 文件中。

build.gradle :构建.gradle

apply from: 'a_file.gradle'

a_file.gradle a_file.gradle

def variable = release // which is undefined

And inside that file, I was using this release property which was not defined anywhere.在那个文件中,我使用了这个未在任何地方定义的release属性。 So I simply fixed that problem.所以我只是解决了这个问题。

In my case I had already the signingConfigs {} block.在我的情况下,我已经有了 signingConfigs {} 块。

What I did to fix this was, make sure that the signingConfigs {} block is declared before the buildTypes {} block.我解决这个问题的方法是,确保在 buildTypes {} 块之前声明了 signingConfigs {} 块。

I didn't know that gradle files are oriented by declaration position.我不知道 gradle 文件以声明 position 为导向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法获取 org.gradle.api.internal.artifacts.configurations 类型的配置容器的未知属性“运行时” - Could not get unknown property 'runtime' for configuration container of type org.gradle.api.internal.artifacts.configurations 无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的 object 获取未知属性“实现” - Could not get unknown property 'implementation' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 无法获取类型为 org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer 的对象的未知属性“GROUP” - Could not get unknown property 'GROUP' for object of type org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer Could not get unknown property 'sourcesJar' for object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication - Could not get unknown property 'sourcesJar' for object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication buildSrc:无法获取 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的 object 的未知属性 - buildSrc: Could not get unknown property for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler Gradle Build Failing: Could not get unknown property 'RunTheProgram' for object of type org.gradle.api.plugins.internal.DefaultJavaApplication - Gradle Build Failing: Could not get unknown property 'RunTheProgram' for object of type org.gradle.api.plugins.internal.DefaultJavaApplication 无法为 org.gradle.api.internal.artifacts.dsl.dependencies 类型的 object 获取未知属性“FLIPPER_VERSION”。 - Could not get unknown property 'FLIPPER_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 无法获取类型为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 的 object 的未知属性“lifecycle_version” - Could not get unknown property 'lifecycle_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象获取未知属性“nav_version” - Could not get unknown property 'nav_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler Android Studio:“无法获得类型为 org.gradle.api.Project 的项目的未知属性‘VERSION_NAME’” - Android Studio : “Could not get unknown property 'VERSION_NAME' for project of type org.gradle.api.Project”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM