Я новичок в студии Android, и я создаю свое приложение с помощью react-native. Когда я открыл студию android, началась сборка Gradle, и я получил эту ошибку
Could not find com.android.tools.build:gradle:4.0.0.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-share-extension
Open File
Я искал вопрос о переполнении стека, я пробовал много решений, но у меня ничего не сработало, что я уже пробовал gradlew clean
, gradlew build --refresh-dependencies
, gradlew cleanBuildCache
, но все эти команды показали один и тот же журнал ошибок. Затем я удалил папку android/.gradle
и android/.idea
, а также файл app.iml
(но все еще та же ошибка). Также я пробовал npm cache clean --force
из каталога проекта response-native. Я также пробовал File> invalidate Caches /Restart
. android/build.gradle
файл
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:4.0.0')
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://maven.google.com/' }
maven { url 'https://www.jitpack.io/' }
}
}
android\gradle\wrapper\gradle-wrapper.properties
#Wed Jul 08 20:28:12 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
android\app\build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.google.firebase:firebase-analytics:17.2.2'
//adding firebase sdk
//adding auth dpendecy manually
implementation 'com.google.android.gms:play-services-auth:18.0.0'
//noinspection GradleDynamicVersion
//implementaion of react native image picker
implementation project(':react-native-image-picker')
implementation 'com.android.support:multidex:1.0.3'
implementation "com.facebook.react:react-native:+" // From node_modules
// adding share extension
implementation project(':react-native-share-extension')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
Пожалуйста, предложите все, что мне здесь не хватает. Хотя npm run android
работает нормально, и я могу установить приложение на эмулятор. Вы можете увидеть мою версию Gradle и версию плагина Gradle
Вывод gradlew tasks --stacktrace
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-share-extension'.
> Could not resolve all artifacts for configuration ':react-native-share-extension:classpath'.
> Could not find com.android.tools.build:gradle:4.0.0.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of
the repository declaration.
Required by:
project :react-native-share-extension
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 13s