1

我是安卓新手。人们告诉我我可以使用 gradlew.bat 来构建一个 apk。当我在调试中启动它时,它似乎可以运行,但我在任何地方都找不到 .apk。这是怎么回事?

e:\dev\mobility\mob-ion>android\gradlew.bat --status

e:\dev\mobility\mob-ion>if "Windows_NT" == "Windows_NT" setlocal

e:\dev\mobility\mob-ion>set DEFAULT_JVM_OPTS=

e:\dev\mobility\mob-ion>set DIRNAME=e:\dev\mobility\mob-ion\android\

e:\dev\mobility\mob-ion>if "e:\dev\mobility\mob-ion\android\" == "" set DIRNAME=.

e:\dev\mobility\mob-ion>set APP_BASE_NAME=gradlew

e:\dev\mobility\mob-ion>set APP_HOME=e:\dev\mobility\mob-ion\android\

e:\dev\mobility\mob-ion>if defined JAVA_HOME goto findJavaFromJavaHome

e:\dev\mobility\mob-ion>set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_201

e:\dev\mobility\mob-ion>set JAVA_EXE=C:\Program Files\Java\jdk1.8.0_201/bin/java.exe

e:\dev\mobility\mob-ion>if exist "C:\Program Files\Java\jdk1.8.0_201/bin/java.exe" goto init

e:\dev\mobility\mob-ion>if not "Windows_NT" == "Windows_NT" goto win9xME_args

e:\dev\mobility\mob-ion>if "@eval[2+2]" == "4" goto 4NT_args

e:\dev\mobility\mob-ion>set CMD_LINE_ARGS=

e:\dev\mobility\mob-ion>set _SKIP=2

e:\dev\mobility\mob-ion>if "x--status" == "x" goto execute

e:\dev\mobility\mob-ion>set CMD_LINE_ARGS=--status

e:\dev\mobility\mob-ion>goto execute

e:\dev\mobility\mob-ion>set CLASSPATH=e:\dev\mobility\mob-ion\android\\gradle\wrapper\gradle-wrapper.jar

e:\dev\mobility\mob-ion>"C:\Program Files\Java\jdk1.8.0_201/bin/java.exe"    "-Dorg.gradle.appname=gradlew" -classpath "e:\dev\mobility\mob-ion\android\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain --status
PID STATUS   INFO
22140 IDLE     4.10.1
27356 IDLE     4.10.1
22428 STOPPED  (after being idle for 6 minutes and not recently used and to reclaim system memory)

Only Daemons for the current Gradle version are displayed. See https://docs.gradle.org/4.10.1/userguide/gradle_daemon.html#sec:status

e:\dev\mobility\mob-ion>if "0" == "0" goto mainEnd

e:\dev\mobility\mob-ion>if "Windows_NT" == "Windows_NT" endlocal
e:\dev\mobility\mob-ion>
4

2 回答 2

1

尝试使用gradlew.bat build命令,这应该在 .apk 上创建 .apk android/app/build/outputs/apk/debug/app-debug.apk

还要检查gradlew.bat task,因为它会向您显示更多可用任务,例如installDebug在连接的设备中安装应用程序。

于 2019-02-22T16:25:32.633 回答
0

我不完全了解这种方法,但是,当我使用 CLI 构建 apk 时,它会在下面的路径中生成。

平台/android/build/output/apk/debug/debug.apk

可能这个方法也会在那里生成。

于 2019-02-21T17:18:15.827 回答