一、报错信息
在 Android Studio 的 Terminal 终端执行 gradlew 报错 , 报错信息如下 :
PS Y:\002_WorkSpace\001_AS\Coroutine> gradlew app:dependencies --configuration releaseRuntimeClasspath
gradlew : 无法将“gradlew”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
PS Y:\002_WorkSpace\001_AS\Coroutine> gradlew
gradlew : 无法将“gradlew”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ gradlew
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (gradlew:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: 找不到命令 gradlew,但它确实存在于当前位置。默认情况下,Windows PowerShell 不会从当前位置加载命令。如果信任此命令,请改为键入“.\gradlew”。
有关详细信息,请参阅 "get-help about_Command_Precedence"。
二、问题分析
在之前的 Terminal 中可以执行 gradlew 命令 ;
更新到最新版的 Android Studio Dolphin 2021.3.1 版本后 , 出现上述问题 ;
这里注意到 Windows 终端发生了改变 , 原来的中断是 Windows cmd 命令行中断 ;
最新的 Android Studio 中 , 使用的是 Windows PowerShell 终端 ;
在 Windows 中执行 bat 脚本时 , 需要使用
./可执行文件
执行命令 ;
三、解决方案
将要执行的
gradlew app:dependencies --configuration releaseRuntimeClasspath
命令 ,. 修改为文章来源:https://www.toymoban.com/news/detail-520125.html
.\gradlew app:dependencies --configuration releaseRuntimeClasspath
命令 , 执行结果为 :文章来源地址https://www.toymoban.com/news/detail-520125.html
PS Y:\002_WorkSpace\001_AS\Coroutine> .\gradlew app:dependencies --configuration releaseRuntimeClasspath
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'Coroutine', project ':app'
> Task :app:dependencies
------------------------------------------------------------
Project :app
------------------------------------------------------------
releaseRuntimeClasspath - Runtime classpath of compilation 'release' (target (androidJvm)).
+--- org.jetbrains.kotlin:kotlin-stdlib:1.5.0 -> 1.7.10
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10
| \--- org.jetbrains:annotations:13.0
+--- androidx.core:core-ktx:+ -> 1.9.0
| +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| +--- androidx.core:core:1.9.0
| | +--- androidx.annotation:annotation:1.2.0 -> 1.3.0
| | +--- androidx.annotation:annotation-experimental:1.3.0
| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)
| | +--- androidx.collection:collection:1.0.0 -> 1.1.0
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.concurrent:concurrent-futures:1.0.0
| | | +--- com.google.guava:listenablefuture:1.0
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.lifecycle:lifecycle-runtime:2.3.1 -> 2.5.1
| | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | +--- androidx.arch.core:core-common:2.1.0
| | | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | +--- androidx.arch.core:core-runtime:2.1.0
| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | | \--- androidx.arch.core:core-common:2.1.0 (*)
| | | \--- androidx.lifecycle:lifecycle-common:2.5.1
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.versionedparcelable:versionedparcelable:1.1.1
| | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| | \--- androidx.core:core-ktx:1.9.0 (c)
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)
| \--- androidx.core:core:1.9.0 (c)
+--- androidx.appcompat:appcompat:1.5.1
| +--- androidx.activity:activity:1.5.1
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| | +--- androidx.core:core:1.8.0 -> 1.9.0 (*)
| | +--- androidx.lifecycle:lifecycle-runtime:2.5.1 (*)
| | +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1
| | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1 (c)
| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1
| | | +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | | +--- androidx.core:core-ktx:1.2.0 -> 1.9.0 (*)
| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.5.1
| | | | +--- androidx.arch.core:core-common:2.1.0 (*)
| | | | +--- androidx.arch.core:core-runtime:2.1.0 (*)
| | | | \--- androidx.lifecycle:lifecycle-common:2.5.1 (*)
| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 (*)
| | | +--- androidx.savedstate:savedstate:1.2.0
| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | | +--- androidx.arch.core:core-common:2.1.0 (*)
| | | | +--- androidx.lifecycle:lifecycle-common:2.4.0 -> 2.5.1 (*)
| | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.7.10 (*)
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1
| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1
| | | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.1
| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.1
| | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1 (c)
| | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1 (c)
| | | | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.1 (c)
| | | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0
| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.0 -> 1.7.10 (*)
| | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0
| | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.0 -> 1.7.10 (*)
| | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.0 -> 1.7.10
| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.1 (*)
| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0 (*)
| | +--- androidx.savedstate:savedstate:1.2.0 (*)
| | +--- androidx.tracing:tracing:1.0.0
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| +--- androidx.annotation:annotation:1.3.0
| +--- androidx.appcompat:appcompat-resources:1.5.1
| | +--- androidx.annotation:annotation:1.2.0 -> 1.3.0
| | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| | +--- androidx.core:core:1.6.0 -> 1.9.0 (*)
| | +--- androidx.vectordrawable:vectordrawable:1.1.0
| | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | +--- androidx.core:core:1.1.0 -> 1.9.0 (*)
| | | \--- androidx.collection:collection:1.1.0 (*)
| | +--- androidx.vectordrawable:vectordrawable-animated:1.1.0
| | | +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)
| | | +--- androidx.interpolator:interpolator:1.0.0
| | | | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | | \--- androidx.collection:collection:1.1.0 (*)
| | \--- androidx.appcompat:appcompat:1.5.1 (c)
| +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| +--- androidx.core:core:1.8.0 -> 1.9.0 (*)
| +--- androidx.core:core-ktx:1.8.0 -> 1.9.0 (*)
| +--- androidx.cursoradapter:cursoradapter:1.0.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| +--- androidx.drawerlayout:drawerlayout:1.0.0 -> 1.1.1
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.core:core:1.2.0 -> 1.9.0 (*)
| | \--- androidx.customview:customview:1.1.0
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.core:core:1.3.0 -> 1.9.0 (*)
| | \--- androidx.collection:collection:1.1.0 (*)
| +--- androidx.emoji2:emoji2:1.2.0
| | +--- androidx.annotation:annotation:1.2.0 -> 1.3.0
| | +--- androidx.collection:collection:1.1.0 (*)
| | +--- androidx.core:core:1.3.0 -> 1.9.0 (*)
| | +--- androidx.lifecycle:lifecycle-process:2.4.1
| | | +--- androidx.lifecycle:lifecycle-runtime:2.4.1 -> 2.5.1 (*)
| | | +--- androidx.startup:startup-runtime:1.1.1
| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | | | \--- androidx.tracing:tracing:1.0.0 (*)
| | | \--- androidx.annotation:annotation:1.2.0 -> 1.3.0
| | \--- androidx.startup:startup-runtime:1.0.0 -> 1.1.1 (*)
| +--- androidx.emoji2:emoji2-views-helper:1.2.0
| | +--- androidx.collection:collection:1.1.0 (*)
| | +--- androidx.core:core:1.3.0 -> 1.9.0 (*)
| | \--- androidx.emoji2:emoji2:1.2.0 (*)
| +--- androidx.fragment:fragment:1.3.6
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.core:core:1.2.0 -> 1.9.0 (*)
| | +--- androidx.collection:collection:1.1.0 (*)
| | +--- androidx.viewpager:viewpager:1.0.0
| | | +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | | +--- androidx.core:core:1.0.0 -> 1.9.0 (*)
| | | \--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)
| | +--- androidx.loader:loader:1.0.0
| | | +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | | +--- androidx.core:core:1.0.0 -> 1.9.0 (*)
| | | +--- androidx.lifecycle:lifecycle-livedata:2.0.0
| | | | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0 -> 2.5.1 (*)
| | | | \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
| | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.5.1 (*)
| | +--- androidx.activity:activity:1.2.4 -> 1.5.1 (*)
| | +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1 -> 2.5.1 (*)
| | +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1 -> 2.5.1 (*)
| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1 -> 2.5.1 (*)
| | +--- androidx.savedstate:savedstate:1.1.0 -> 1.2.0 (*)
| | \--- androidx.annotation:annotation-experimental:1.0.0 -> 1.3.0 (*)
| +--- androidx.lifecycle:lifecycle-runtime:2.5.1 (*)
| +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 (*)
| +--- androidx.resourceinspection:resourceinspection-annotation:1.0.1
| | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| +--- androidx.savedstate:savedstate:1.2.0 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 (*)
| \--- androidx.appcompat:appcompat-resources:1.5.1 (c)
+--- com.google.android.material:material:1.6.1
| +--- androidx.annotation:annotation:1.2.0 -> 1.3.0
| +--- androidx.appcompat:appcompat:1.1.0 -> 1.5.1 (*)
| +--- androidx.cardview:cardview:1.0.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| +--- androidx.coordinatorlayout:coordinatorlayout:1.1.0
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- androidx.core:core:1.1.0 -> 1.9.0 (*)
| | +--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)
| | \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| +--- androidx.constraintlayout:constraintlayout:2.0.1 -> 2.1.4
| | +--- androidx.appcompat:appcompat:1.2.0 -> 1.5.1 (*)
| | +--- androidx.core:core:1.3.2 -> 1.9.0 (*)
| | \--- androidx.constraintlayout:constraintlayout-core:1.0.4
| +--- androidx.core:core:1.5.0 -> 1.9.0 (*)
| +--- androidx.drawerlayout:drawerlayout:1.1.1 (*)
| +--- androidx.dynamicanimation:dynamicanimation:1.0.0
| | +--- androidx.core:core:1.0.0 -> 1.9.0 (*)
| | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| | \--- androidx.legacy:legacy-support-core-utils:1.0.0
| | +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | +--- androidx.core:core:1.0.0 -> 1.9.0 (*)
| | +--- androidx.documentfile:documentfile:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | +--- androidx.loader:loader:1.0.0 (*)
| | +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | \--- androidx.print:print:1.0.0
| | \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
| +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)
| \--- androidx.viewpager2:viewpager2:1.0.0
| +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| +--- androidx.fragment:fragment:1.1.0 -> 1.3.6 (*)
| +--- androidx.recyclerview:recyclerview:1.1.0 (*)
| +--- androidx.core:core:1.1.0 -> 1.9.0 (*)
| \--- androidx.collection:collection:1.1.0 (*)
\--- androidx.constraintlayout:constraintlayout:2.1.4 (*)
(c) - dependency constraint
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
PS Y:\002_WorkSpace\001_AS\Coroutine>
到了这里,关于【错误记录】在 Android Studio 的 Terminal 终端执行 gradlew 报错 ( 无法将“gradlew”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称 )的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!