我已通过引用此项目在我的项目中实现了电话号码检测和SMS验证功能
https://www.programcreek.com/java-api-examples/?code=android%2Fidentity-samples%2Fidentity-samples-master%2FSmsVerification%2Fapp%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fsamples%2Fsmartlock%2Fsms_verify%2Fui%2FPhoneNumberActivity.java#
我从下面的链接下载并导入了 Volley
https://github.com/google/volley
构建项目时出现错误,请指导我我是android studio的新手...
错误
Unable to find method 'org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt
gradle-wrapper.propertiesdistributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
build.gradle// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
更新:我从C:\ Users \ MY PC.gradle \ wrapper \ dists删除了gradle文件并重建了项目,现在出现了此错误
Error Unknown host 'services.gradle.org'. You may need to adjust the proxy settings in Gradle. Enable Gradle 'offline mode' and sync project Learn about configuring HTTP proxies in Gradle
最佳答案
将gradle-wrapper.properties中的distributionUrl更改为distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
以使构建再次运行。这似乎是一个类似的问题Gradle sync failed: Unable to find method.
关于android - 导入 Volley 库后,gradle构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63480665/