gpt4 book ai didi

android - 找不到属性 'androidTestCompile'

转载 作者:行者123 更新时间:2023-11-30 01:08:30 26 4
gpt4 key购买 nike

我正在尝试使用 firebase 控制台向我的应用程序添加一个 google 登录选项。所以我已经下载了应用程序示例并厌倦了运行,然后在遇到各种错误并纠正它们之后我被困在这一点上请帮忙

Error:(80, 0) Could not find property 'androidTestCompile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@39a8aa.

这是我的 gradle 代码:

 apply plugin: 'com.android.application'

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}

allprojects {
repositories {
jcenter()
}
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.google.firebase.quickstart.auth"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

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

productFlavors {

// Build variant to include the Facebook Android SDk
// The Facebook Android SDK has a min SDK version of 15
facebook {
minSdkVersion 15
}

// Build variant to exclude the Facebook Android SDK
// Firebase Authentication has a min SDK version of 9
nofacebook {
minSdkVersion 9
}

}
}

configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:24.0.0'
}

dependencies {


// Firebase Authentication

// Google Sign In SDK (only required for Google Sign In)

// Facebook Android SDK (only required for Facebook Login)
// This is only compiled into the 'facebook' variant of this app. You can build
// a 'nofacebook' variant to test on devices with SDK < 15.
facebookCompile 'com.facebook.android:facebook-android-sdk:4.9.0'

// Twitter Android SDK (only required for Twitter Login)
compile('com.twitter.sdk.android:twitter-core:1.6.6@aar') {
transitive = true
}
compile('com.twitter.sdk.android:twitter:1.13.1@aar') {
transitive = true;
}

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile
'com.android.support.test:runner:0.5'
compile
'com.android.support:appcompat-v7:24.1.1'compile
'com.google.firebase:firebase-auth:9.2.1'compile
'com.google.android.gms:play-services-auth:9.2.1'}

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

最佳答案

以正常方式格式化您的 build.gradle:

apply plugin: 'com.android.application'

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}

allprojects {
repositories {
jcenter()
}
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.google.firebase.quickstart.auth"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

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

productFlavors {

// Build variant to include the Facebook Android SDk
// The Facebook Android SDK has a min SDK version of 15
facebook {
minSdkVersion 15
}

// Build variant to exclude the Facebook Android SDK
// Firebase Authentication has a min SDK version of 9
nofacebook {
minSdkVersion 9
}

}
}

configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:24.0.0'
}

dependencies {

// Firebase Authentication

// Google Sign In SDK (only required for Google Sign In)

// Facebook Android SDK (only required for Facebook Login)
// This is only compiled into the 'facebook' variant of this app. You can build
// a 'nofacebook' variant to test on devices with SDK < 15.
facebookCompile 'com.facebook.android:facebook-android-sdk:4.9.0'

// Twitter Android SDK (only required for Twitter Login)
compile('com.twitter.sdk.android:twitter-core:1.6.6@aar') {
transitive = true
}
compile('com.twitter.sdk.android:twitter:1.13.1@aar') {
transitive = true;
}

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
}

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

Android Dev Studio 中有一个用于自动格式化的热键 - ALT + CMD + L

关于android - 找不到属性 'androidTestCompile',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38688673/

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