Spa*_*roo 5 android gradle maven react-native npx
运行命令时npx react-native run-android --port=80 --verbose
出现错误:
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=80
然后在上面我可以看到:
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\location\node_modules\react-native-create-thumbnail\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':react-native-create-thumbnail'.
> Plugin with id 'maven' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-create-thumbnail'.
> compileSdkVersion is not specified.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
Run Code Online (Sandbox Code Playgroud)
到目前为止我做了什么:
在 gradle-wrapper.properties 中将 distributionUrl 设置为 https\://services.gradle.org/distributions/gradle-7.0-all.zip
在代码中检查版本
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 28
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
if (project == rootProject) {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
// ref: https://www.baeldung.com/maven-local-repository
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()
}
Run Code Online (Sandbox Code Playgroud)
我在这里不知所措,任何帮助将不胜感激。
小智 1
Gradle 7.0 删除了对 maven 的支持,现在您需要 maven-publish https://docs.gradle.org/7.0/userguide/publishing_maven.html#publishing_maven
类似于 SO:找不到 id 'maven' 的插件
| 归档时间: |
|
| 查看次数: |
527 次 |
| 最近记录: |