ace build apk --debug 系统找不到指定路径的解决办法【坚果派】 原创

鸿蒙坚果派
发布于 2023-8-18 18:59
浏览
0收藏

ace build apk --debug 系统找不到指定路径的解决办法

首先运行

ace check

会得到下面的信息

[√] ArkUI-X(v1.0.0 Alpha)
  • ArkUI-X SDK at D:\huawei\arkui-x
  • Node.js Runtime Environment at D:\huawei\nodejs
  • Java Sdk at C:\Program Files\Huawei\DevEco Studio\jbr
  • Ohpm at C:\Users\jianguo\AppData\Local\Huawei
[√] OpenHarmony toolchains - develop for OpenHarmony devices
  • OpenHarmony SDK at C:\Users\jianguo\AppData\Local\OpenHarmony\Sdk
  • Node.js Runtime Environment at D:\huawei\nodejs
  • Java Sdk at C:\Program Files\Huawei\DevEco Studio\jbr
  • Ohpm at C:\Users\jianguo\AppData\Local\Huawei
[√] HarmonyOS toolchains - develop for HarmonyOS devices
  • HarmonyOS SDK at C:\Users\jianguo\AppData\Local\Huawei\Sdk
  • Node.js Runtime Environment at D:\huawei\nodejs
  • Java Sdk at C:\Program Files\Huawei\DevEco Studio\jbr
  • Ohpm at C:\Users\jianguo\AppData\Local\Huawei
[√] Android toolchains - develop for Android devices
[√] DevEco Studio [Requires DevEco Studio 4.0 Beta2, API Version 10+]
  • DevEco Studio at C:\Program Files\Huawei\DevEco Studio\bin
  • Android Studio at C:\Program Files\Android\Android Studio\bin
Tools info :[√] OpenHarmony hdc installed [√] HarmonyOS hdc installed [√] adb installed
[!] No connected device

仔细点就会发现ohpm的路径有问题,

我们可以打开IDE,去搜一下Ohpm的路径,发现是下面这个路径,然后配置

ace config --ohpm-dir   C:\Users\jianguo\ohpm\ohpm-1.2.4

ace build apk --debug   系统找不到指定路径的解决办法【坚果派】-鸿蒙开发者社区

 config [options]
          --openharmony-sdk     [OpenHarmony SDK]
          --harmonyos-sdk       [HarmonyOS SDK]
          --android-sdk         [Android Sdk]
          --deveco-studio-path  [DevEco Studio Path]
          --android-studio-path [Android Studio Path]
          --build-dir           [Build Dir]
          --nodejs-dir          [Nodejs Dir]
          --java-sdk            [Java Sdk]
          --arkui-x-sdk         [ArkUI-X SDK]
          --ohpm-dir            [Ohpm Dir]

这个时候我们在运行

ace build apk --debug   
PS D:\sample\arkui-x\demo> ace build apk --debug                                   
Start compiling jsBundle...
install completed in 0s 17ms
> hvigor Finished :entry:default@PreBuild... after 195 ms 
> hvigor Finished :entry:default@MergeProfile... after 5 ms 
> hvigor Finished :entry:default@GenerateLoaderJson... after 11 ms 
> hvigor Finished :entry:default@ProcessProfile... after 169 ms 
> hvigor Finished :entry:default@ProcessResource... after 2 ms 
> hvigor Finished :entry:default@CompileResource... after 1 s 157 ms 
> hvigor Finished :entry:default@CompileArkTS... after 5 s 367 ms 
> hvigor BUILD SUCCESSFUL in 7 s 83 ms 
> hvigor Finished :entry:ohosTest@PreBuild... after 8 ms 
> hvigor Finished :entry:ohosTest@MergeProfile... after 3 ms 
> hvigor Finished :entry:ohosTest@GenerateLoaderJson... after 9 ms 
> hvigor Finished :entry:ohosTest@ProcessProfile... after 131 ms 
> hvigor Finished :entry:ohosTest@ProcessResource... after 2 ms 
> hvigor Finished :entry:ohosTest@CompileResource... after 102 ms 
> hvigor Finished :entry:ohosTest@OhosTestCompileArkTS... after 4 s 978 ms 
> hvigor BUILD SUCCESSFUL in 5 s 389 ms 

android Gradle File: D:\sample\arkui-x\demo\.arkui-x\android\app\build.gradle
Start building apk...
Downloading https://repo.huaweicloud.com/gradle/gradle-7.5-all.zip
........................................................................................................................................................
......
Unzipping C:\Users\jianguo\.gradle\wrapper\dists\gradle-7.5-all\53f1ffk4w1cpu9gl7h9reqjeg\gradle-7.5-all.zip to C:\Users\jianguo\.gradle\wrapper\dists\g
radle-7.5-all\53f1ffk4w1cpu9gl7h9reqjeg

Welcome to Gradle 7.5!

Here are the highlights of this release:
 - Support for Java 18
 - Support for building with Groovy 4
 - Much more responsive continuous builds
 - Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
Checking the license for package Android SDK Tools in C:\Users\jianguo\AppData\Local\Android\Sdk\licenses
License for package Android SDK Tools accepted.
Preparing "Install Android SDK Tools (revision: 26.1.1)".
"Install Android SDK Tools (revision: 26.1.1)" ready.
Installing Android SDK Tools in C:\Users\jianguo\AppData\Local\Android\Sdk\tools
"Install Android SDK Tools (revision: 26.1.1)" complete.
"Install Android SDK Tools (revision: 26.1.1)" finished.
Checking the license for package Android SDK Build-Tools 30.0.3 in C:\Users\jianguo\AppData\Local\Android\Sdk\licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" ready.
Installing Android SDK Build-Tools 30.0.3 in C:\Users\jianguo\AppData\Local\Android\Sdk\build-tools\30.0.3
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" complete.
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" finished.
Checking the license for package Android SDK Platform 33 in C:\Users\jianguo\AppData\Local\Android\Sdk\licenses
License for package Android SDK Platform 33 accepted.
Preparing "Install Android SDK Platform 33 (revision: 3)".
"Install Android SDK Platform 33 (revision: 3)" ready.
Installing Android SDK Platform 33 in C:\Users\jianguo\AppData\Local\Android\Sdk\platforms\android-33
"Install Android SDK Platform 33 (revision: 3)" complete.
"Install Android SDK Platform 33 (revision: 3)" finished.

> Task :app:processDebugMainManifest
package="com.jianguo.demo" found in source AndroidManifest.xml: D:\sample\arkui-x\demo\.arkui-x\android\app\src\main\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/con
figure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assista
nt for more information.

> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libarkui_android.so, libhilog.so, libhilog_android.so, libresourcemanager.so.      

> Task :app:packageDebug
PackagingOptions.jniLibs.useLegacyPackaging should be set to true because android:extractNativeLibs is set to "true" in AndroidManifest.xml.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2m 12s
31 actionable tasks: 31 executed
Build apk successful.
filepath: D:\sample\arkui-x\demo\.arkui-x\android\app\build\outputs\apk\

你就会发现成功现在成功了。所以我们日常开发的时候,一定要细致一点。

ace build apk --debug   系统找不到指定路径的解决办法【坚果派】-鸿蒙开发者社区

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
1
收藏
回复
举报
回复
    相关推荐