gpt4 book ai didi

android-studio - Android studio/Gradle 奇怪的行为

转载 作者:行者123 更新时间:2023-12-03 17:25:55 25 4
gpt4 key购买 nike

从昨天开始,我在 Android Studio 的新项目中遇到了一个奇怪的错误(甚至没有更新任何东西):

  • What went wrong: Could not determine the dependencies of task ':app:mockableAndroidJar'.

    java.lang.NullPointerException (no error message)

我的 build.gradle 文件似乎无法正确识别字符串:

buildToolsVersion cannot be applied to (java.lang.String)

并在分配字符串的每一行中放置一个错误。

这是我的 build.gradle(没什么特别的):

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion '23.0.2'

defaultConfig {
applicationId "com.dkslf.fragmenttest"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v13:22.0.0'
}

这里可能有什么问题?

编辑: 重启 PC、重启 Android studio 和随机敲击键盘的组合似乎暂时解决了这个问题。不过,我将问题悬而未决,看看我是否可以重现它。

最佳答案

最近遇到了这个,但不太确定我们是否在同一条船上。然而,这就是我解决 mockableAndroid 问题的方法:

-        classpath 'com.android.tools.build:gradle:1.3.0'
+ classpath 'com.android.tools.build:gradle:2.0.0-beta6'

关于android-studio - Android studio/Gradle 奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34017991/

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