java - 找不到参数的方法 implementation() [com.android.support:appcompat-v7:28.0.0]
问题描述
Build.gradle(项目):
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle(模块):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion 28.0
defaultConfig {
applicationId 'com.shiba.honey'
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings true //false
}
buildToolsVersion '28.0.3'
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
当我同步出现这个错误:
在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到参数 [com.android.support:appcompat-v7:28.0.0] 的方法 implementation()。
请从 Android SDK Manager 安装 Android Support Repository。打开 Android SDK 管理器
我从 Android SDK 安装了所有支持存储库,但不知道我能做什么.....
解决方案
试试这个 :
在 build.gradle(Project) 中:
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE : REMOVE IMPLEMENTATION FILES FROM HERE AND USE THEM IN DEPENDENCIES IN BUILD.GRADLE(APP).
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在 build.gradle(app) 中执行此操作:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion 28.0
defaultConfig {
applicationId 'com.shiba.honey'
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings true //false
}
buildToolsVersion '28.0.3'
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
}
推荐阅读
- dask - 将 150 万张图像加载到 dask 集群中的最快方法
- python - 在类中使用 len() *inside* 的正确方法是什么?
- pip - `anaconda3/bin` 和 `anaconda3/lib/python3.7/` 下的包有什么区别?
- php - Postgres COPY ... FROM PROGRAM 失败。权限没问题
- javascript - 无需上传即可检索文件数据(Express、Multer)
- dom - Webapp按钮在谷歌表格中复制表格
- dynamics-crm - 模型驱动的 PowerApps
- ios - RealmSwiftObject 不由 Realm 管理。获取返回类的对象
- haskell - 在 Haskell 中,如何将一个类似列表的 monad 绑定到另一个类似列表的 monad
- typescript - 为什么 TypeScript 既有 `void` 又有 `undefined`?