无法解析com.android.support:appcompat-v7:28.0.0

问题描述 投票:3回答:5

大约有这么多不同的问题,但存在的问题也有关于使用qazxsw POI,qazxsw POI,qazxsw POI但是当我同步项目中,我得到这个错误:

无法解析的依赖“:应用@调试/ compileClasspath”:无法解析com.android.support:appcompat-v7:28.0.0。

我检查v7.28.0和遵循它的指示,但它并没有帮助。

这是我的模块的应用程序

v7.28.+

和的gradle项目:

v7.28.0.0-rc02

Android的工作室互联网连接是好的,因为我在设置测试过,我不知道还有什么地方看。

我甚至在AS 3.2.1创建一个新的项目,但我得到同样的错误。我不知道为什么Support library setup

android android-studio android-gradle
5个回答
6
投票

我相信其他的答案是好的,工作。但幸亏有通过设置代理解决了buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/'} } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1' } } apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' repositories { maven { url 'https://maven.google.com' } } apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig { applicationId "com.mobaleghan.nasimnoor" manifestPlaceholders = [ onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f', // Project number pulled from dashboard, local value is ignored. onesignal_google_project_number: 'REMOTE' ] minSdkVersion 16 targetSdkVersion 28 versionCode 8 versionName "1.6.3" vectorDrawables.useSupportLibrary = true } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable true } } lintOptions { abortOnError false } } dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:preference-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:support-annotations:27.1.1' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation "com.android.support:support-core-utils:28.0.0" implementation 'com.onesignal:OneSignal:3.10.3' }

buildscript { repositories { google() jcenter() } dependencies { 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这个是这样的:

this happens every time I update AS

这些仓库是有根据Freedom of Developers

而顶层构建:

enter image description here

和一切工作正常。


3
投票

Android项目有2个文件的gradle:存储在项目范围之一,并存储在应用范围之一。 (注意的是,一个项目可以有内部许多应用程序,但你通常有一个)。所以,你只需要交换定义库的URL在那些2个gradle这个文件。

第1步:在您的buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/'} } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1' } } apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' repositories { maven { url 'https://maven.google.com' } } apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig { applicationId "com.mobaleghan.nasimnoor" manifestPlaceholders = [ onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f', // Project number pulled from dashboard, local value is ignored. onesignal_google_project_number: 'REMOTE' ] minSdkVersion 16 targetSdkVersion 28 versionCode 9 versionName "1.6.4" vectorDrawables.useSupportLibrary = true } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable true } } lintOptions { abortOnError false } } dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:preference-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:support-annotations:28.0.0' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation "com.android.support:support-core-utils:28.0.0" implementation 'com.onesignal:OneSignal:3.10.3' } 删除这些代码行(APP)

OneSignal documentations

第2步:添加到您的buildscript { repositories { google() jcenter() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { 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() maven { url 'https://maven.google.com/' name 'Google' } } } (项目)

build.gradle

有一件事你必须知道,repositories { maven { url 'https://maven.google.com' } } build.gradle的最后一个稳定版本。所以,你可能要降级版本或迁移一切 allprojects { repositories { google() jcenter() maven { url 'https://maven.google.com' } maven { url 'https://jitpack.io' } mavenCentral() } }

的28.0.0的稳定版本将是最后推出的新功能打包成android.support。随后所有的功能版本将只提供作为androidx包装的假象。

看看这个28.0.0并欢迎android.support的新时代。


0
投票

尝试以下方法:

1)取消选中从构建工具离线工作:文件 - >其他设置 - >默认设置 - >构建,执行,部署 - >构建工具 - > Gradle->取消选中脱机工作选项。

2)如果以上不工作,然后去你的项目的构建和gradle这个下添加库以下内容:

androidX

0
投票

合并这部分从模块的link到根项目的androidX

allprojects {
     repositories {
         jcenter()
         maven {
             url "https://maven.google.com"
         }
     }
}

只有保持在模块的build.gradle这些行:

build.gradle

根项目的buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/'} } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1' } } repositories { maven { url 'https://maven.google.com' } } 应该看起来大约是这样,那么:

build.gradle

0
投票

您仍然可以使用版本28.0.0但似乎它的时间迁移到Android X!

apply plugin: 'com.android.application' apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' android { ... }

注:在Android 9.0(API级别28)的释放有一个名为AndroidX支持库,该库的Jetpack的一部分的新版本。该AndroidX库包含现有的支持库,还包括最新的Jetpack的组件。

您可以继续使用支持库。历史文物(这些版本27和更早版本,并包装成android.support。*)仍然可在谷歌的Maven。然而,将发生在AndroidX库中的所有新图书馆的发展。

我们建议使用AndroidX库中的所有新项目。你也应该考虑现有项目迁移到AndroidX为好。

© www.soinside.com 2019 - 2024. All rights reserved.