gpt4 book ai didi

android - 无法为类型为 org.gradle.api.Project 的项目 'file' 获取未知属性 ':app'

转载 作者:行者123 更新时间:2023-12-05 05:10:44 27 4
gpt4 key购买 nike

我的音乐流媒体应用程序的应用程序项目中不断出现此错误:

Could not get unknown property 'file' for project ':app' of type org.gradle.api.Project.

我想知道我做错了什么。无论我尝试什么,我都会卡住。

这是来自 Android Studio 的应用项目。

apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}

android {

buildTypes {
release {
ndk {
abiFilters "armeabi-v7a" // includes ARM SO files only, so no x86 SO file
}
}
}

// packagingOptions {
// exclude "lib/mips"
// }

compileSdkVersion 28
defaultConfig {
applicationId "cloud.veezee.android"
minSdkVersion 21
targetSdkVersion 28
versionCode 10
versionName "1.1"
renderscriptTargetApi 21
renderscriptSupportModeEnabled true
multiDexEnabled true

// buildConfigField 'String', 'GoogleAndroidClientId', GoogleAndroidClientId
buildConfigField 'String', 'GoogleServerClientId', GoogleServerClientId
}
signingConfigs {
release {
storeFile file("../keystore.jks")
storePassword ANDROID_STORE_PASSWORD
keyAlias ANDROID_STORE_ALIAS
keyPassword ANDROID_KEY_PASSWORD
}
buildTypes {
release {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.release
}
}
}

dataBinding {
enabled = true
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.anko:anko-commons:0.10.7"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-media-compat:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'me.everything:overscroll-decor-android:1.0.4'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.google.android.exoplayer:exoplayer:2.7.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'com.appsee:appsee-android:2.4.1'
implementation 'com.danikula:videocache:2.7.0'
implementation 'com.couchbase.lite:couchbase-lite-android:2.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'
implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
implementation 'jp.wasabeef:glide-transformations:3.3.0'
kapt 'com.github.bumptech.glide:compiler:4.7.1'

implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
}
}

afterEvaluate {
initFabricPropertiesIfNeeded()
}

def initFabricPropertiesIfNeeded() {
def propertiesFile = file
if (!propertiesFile.exists()) {
ant.propertyfile(file: "fabric.properties", comment: commentMessage) {
entry(key: "apiSecret", value: FabricSecretKey)
entry(key: "apiKey", value: FabricApiKey)
}
}
}

最佳答案

App: Could not get unknown property 'file' for project ':app' of type org.gradle.api.Project.

问题出在这一行:

def initFabricPropertiesIfNeeded() {
def propertiesFile = file
//....
}

您可以查看 official doc .

The Project.file(java.lang.Object) method is used to create a file or directory path relative to the current project and is a common way to make build scripts work regardless of the project path.

你必须像这样改变你的脚本:

def propertiesFile = file('myFile.properties')

(可能是,但我不确定 def propertiesFile = file('fabric.properties'))

关于android - 无法为类型为 org.gradle.api.Project 的项目 'file' 获取未知属性 ':app',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56372598/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com