- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我记得我没有在我的 Gradle 中编辑任何东西,突然我意识到我不能再同步项目 Gradle,向我显示此错误:错误:无法在空对象上调用方法 buildTypes()
我在 StackOverflow 中搜索了我的问题并找到了一些类似的问题,但没有一个对我有用
这是我的 Gradle :
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.myapp.test"
minSdkVersion 18
targetSdkVersion 27
//todo: change the versionCode and the versionName before upload in store
versionCode 22
versionName "2.4.0"
aaptOptions {
additionalParameters "--no-version-vectors"
}
} buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.google.firebase:firebase-crash:16.2.1'
testImplementation 'junit:junit:4.12'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'agency.tango.android:material-intro-screen:0.0.5'
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true
}
implementation ('com.crashlytics.sdk.android:crashlytics-ndk:2.0.4@aar') {
transitive = true
}
}
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
我不知道如何修复它,所以我需要你的帮助。
最佳答案
将 buildTypes
语句移到下一行。
使用
}
buildTypes {
代替
} buildTypes {
关于android - 如何在同步 Gradle 时修复 android studio 中的 'Cannot invoke method buildTypes()' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57325207/
我想在我的项目中配置第三个 BuildType,它继承另一个 BuildType 的所有配置。 我该怎么做? 最佳答案 只需在构建类型中使用 initWith 属性即可: uitesting {
我有两个 gradle 模块 :app (安卓应用) :data (安卓库):app取决于 :data .我创建了一个额外的 buildType对于两个名为 mock 的模块.当我构建 :app在 m
我创建了如下的自定义 buildType: buildTypes { releasefree.initWith(buildTypes.release) release
我的Android项目具有多种构建类型和productFlavors flavorDimensions "default" productFlavors { favor1
这是我的 build.gradle(Module: app) 的一部分 buildTypes { release { minifyEnabled false p
我正在使用 android 实验性插件 0.4 ( gradle 2.8 ) 并想修改与 buildType 关联的所有任务;在我的案例中进行调试。 目前,我正在使用以下“hack”: tasks.a
enter image description here 我正面临这个问题 Could not find method buildTypes() for arguments [build_3r52yu
我在buildTypes中有四个条目。它工作正常,我可以在linux终端上触发gradle build命令,在项目目录中创建8个apk文件,等等。在android studio中,我可以在构建版本之间
谁能解释buildTypes块如何在Gradle中工作? 据我所知,调试块在 Debug模式下运行,发布块在 Release模式下运行。 但是,如果我运行Gradle脚本,则这两个块都将运行! b
我无法创建使用不同 list 的两种不同构建类型。即使使用--rerun-tasks重新运行gradle并完全删除了构建目录后,apk中包含的AndroidManifest还是不正确的。例如,我运行a
我的项目gradle文件中出现此错误: 'buildTypes' cannot be applied to '(groovy.lang.Closure)' 我目前正在使用Android Studio
我正在使用以下配置: android { // a lot more of definitions... signingConfigs { // For advanced-artefacts,
BuildType 对象(Gradle Android 插件)的这两个属性有什么区别? applicationIdSuffix 和 packageNameSuffix? zipAlign 属性是什么意
我是 Gradle 构建工具的新手。我想在 Android 应用程序中创建常量 OPEN_WEATHER_MAP_API_KEY 但出现以下错误 构建.gradle `apply plugin:
我想通过以下方式区分发布和调试 buildTypes: buildTypes { release { minifyEnabled false signingC
我有三种构建类型,我试图让 staging 构建类型运行,但我收到以下错误: Error: The apk for your currently selected variant (app-stagi
我有一个 Android 应用程序,我想更改调试和其他 buildTypes 的应用程序标签。我没有任何口味! 这是我认为应该有效的设置: -src |-debug |-res
我想设置一个项目来构建两个可以安装在同一设备上的不同 apk - 其中一个是生产 apk,第二个是调试 apk。为此,我在 build.gradle 中定义了: buildTypes {
我有 2 种风格的应用程序,每种都有自己的 google maps (v1) key 用于调试和发布(意味着总共有 4 个 key )。所以我想知道我是否可以根据 buildType 和 produc
决定使用 Gradle 6.5 从 Android gradle plugin 3.5.x 切换到 gradle plugin 4.10 并坚持错误。 这是我的 build.gradle defaul
我是一名优秀的程序员,十分优秀!