当我尝试从命令行构建Android项目时,我收到以下错误消息:
配置项目':mylib'时出现问题。 无法解析配置':mylib:classpath'的所有文件。 找不到com.android.tools.build:gradle:3.0.0。 在以下位置搜索:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar https://repo1.maven.org/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar 要求:project:mylib
当我尝试直接通过浏览器访问地址“https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom”时,会显示以下内容:
$ awk '
BEGIN{
FS=OFS=SUBSEP=",";
}
FNR==1{
printf("%s%s%s",$1,OFS,$2);
next
}
{
if(!(($1,$2) in tmp)){
usr[++u] = $1 OFS $2
tmp[$1,$2]
}
if(!($3 in tmp)){
names[++n] = $3;
tmp[$3]
printf("%s%s",OFS,$3)
}
arr[$1,$2,$3] = $4
}
END{
print ""
for(u=1; u in usr; u++){
printf("%s", usr[u]);
for(n=1; n in names; n++){
indexkey = usr[u] SUBSEP names[n]
printf("%s%s",OFS, (indexkey in arr) ? arr[indexkey]:"")
}
print ""
}
}
' infile
Driver Id,Driver Name,Total Offers,Driver Reject,Driver Accept ,Expired Offers,Total Bookings,Rider Cancels,Driver Cancels,Rider No-Show,Completed Rides
123,XYZ,10,0,4,3,6,2,0,0,4
124,PQR,2,0,1,1,1,0,0,0,1
根gradle文件包含以下代码:
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}
文件gradle-wrapper.properties包含以下值:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
...
allprojects {
repositories {
jcenter()
google()
}
}
如果我从Android Studio 3.0编译,相同的配置工作正常。 但是如果我尝试直接从命令行编译,我会收到错误。
有人能帮助我吗?
答案 0 :(得分:29)
我的问题是" ./ gradlew assembleDebug"出现了,Android studio构建成功。我这样解决了
arr= 4 5 8
22 23 0
或
arr= 4 5 8
22 0 0
答案 1 :(得分:4)
我不太确定,但也许您应该尝试将repositories标记放在依赖项标记的同一级别。所以:
buildscript {
repositories {
...
}
dependencies {
...
}
}