开发人员环境:
当我git clone git@github.com:google/search-samples.git
时,我打开app-indexing-start项目,同步.....我遇到问题:
Could not find support-v13.jar (com.android.support:support-v13:23.3.0).
Searched in the following locations:
http://maven.aliyun.com/nexus/content/repositories/jcenter/com/android/support/support-v13/23.3.0/support-v13-23.3.0.jar
Please install the Android Support Repository from the Android SDK Manager.
打开Android SDK管理器
/etc/apt/sources.list
:
deb cdrom:[Ubuntu 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted #Added by software-properties
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse universe #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main multiverse universe restricted #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted #Added by software-properties
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb https://typora.io/linux ./
# deb-src https://typora.io/linux ./
# deb-src https://typora.io/linux ./
# deb-src https://typora.io/linux ./
deb https://download.sublimetext.com/ apt/stable/
# deb-src https://download.sublimetext.com/ apt/stable/
答案 0 :(得分:0)
您需要将AGP版本至少更新为3.0.0。但是,最好使用最新版本3.2.1。例如。最高级别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.google.gms:google-services:4.2.0'
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
gradle-wrapper.properties
更改为以下
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
答案 1 :(得分:0)
我之前也遇到过类似的问题。也许您的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:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
flatDir
{
dirs 'libs'
}
google()
mavenLocal()
maven {
url "http://mvnrepo.alibaba-inc.com/mvn/repository"
}
maven {
url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当您从专用遥控器运行项目引用时,就会出现您所说的问题!,有时是从阿里巴巴公司获得一个项目,或者该项目具有来自远程的私人引用,问题发生了。
所以就这样做,这将使项目通过正常渠道而不是阿里巴巴私有存储库中的Android支持库进行构建。
// maven {
// url "http://mvnrepo.alibaba-inc.com/mvn/repository"
// }
// maven {
// url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
// }