Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译环境问题 #33

Closed
gongyu0725 opened this issue Feb 13, 2023 · 1 comment
Closed

编译环境问题 #33

gongyu0725 opened this issue Feb 13, 2023 · 1 comment
Labels
Glitch ☂️ 小问题 Usually an issue easy to resolve Stale 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month)

Comments

@gongyu0725
Copy link

image

你好,项目的配置环境方便写个小文档吗,搞了一天没搞定,哭晕!

@SuperMonster003
Copy link
Owner


编译与构建


建议始终使用 Android Studio 进行 AutoJs6 调试或开发.

如需使用 IntelliJ IDEA (Jetbrains 公司产品), 需留意以下注意事项:

  • IntelliJ IDEA 版本建议不低于 2022.3.3 (Ultimate Edition)
  • IntelliJ IDEA 的 Gradle JVM 版本不低于 18
  • 回退 Gradle 构建工具版本至 IDEA 支持的版本
    • classpath("com.android.tools.build:gradle:7.4.0-beta02")
    • 具体版本可根据 IDEA 的错误提示获知
  • 回退 Kotlin 脚本 (KTS) 语法
    • com.android.build.api.dsl.CommonExtension#options 需回退为 packagingOptions
  • ... ...

Android Studio 准备

下载 Android Studio Flamingo | 2022.2.1 Beta 5 版本 (按需选择其一):

注: 如需下载其他版本, 或上述链接已失效, 可前往 Android Studio 发行版本归档 页面.

安装或解压上述文件, 运行 Android Studio 软件 (如 "D:\android-studio\bin\studio64.exe").

Android SDK 准备

注: 如果计算机系统已安装 Android SDK (安卓软件开发工具包), 则可跳过此小节内容.

在 Android Studio 软件中使用快捷键 CTRL + ALT + S 打开设置页面:

Appearance & Behavior (外观与表现) -> 
System Settings (系统设置) -> 
Android SDK (安卓软件开发工具包)

Android SDK Location (安卓软件开发工具包位置) 处如果是空白内容, 可点击右侧 Edit (编辑) 按钮, 在弹出的窗口中多次点击 Next (下一步).

注: 过程中可能需要同意一个或多个相关协议才能继续.

待相关资源下载并安装完毕, 点击 Finish (完成) 按钮.
上述 Android SDK Location (安卓软件开发工具包位置) 处将自动完成路径填写, SDK 准备工作随即完成.

JDK 准备

AutoJs6 项目依赖的 JDK (Java 开发工具包) 发行版本不低于 18.

注: 如果计算机系统已安装 JDK 且版本不低于 18, 则可跳过此小节内容.

在 Android Studio 软件中使用快捷键 CTRL + ALT + S 打开设置页面:

Build, Execution, Deployment (构建, 执行, 开发) ->
Build Tools (构建工具) -> 
Gradle

Gradle JDK 处可选择或添加不同版本的 JDK.

  • 列表中存在合适版本的 JDK
    • 直接选择即可
  • 选择 Download JDK (下载 JDK) 下载新的 JDK
    • 选择一个版本不低于 18 的 JDK, 点击 Download (下载) 按钮并等待下载完成
  • 选择 Add JDK (添加 JDK) 添加已存在的本地 JDK
    • 如计算机系统已存在合适版本的 JDK, 可定位其目录并完成 JDK 添加

AutoJs6 资源克隆

在 Android Studio 主页面点击 Get from VCS (从版本控制系统获取) 按钮.
URL (统一资源定位地址) 处填入 https://github.com/SuperMonster003/AutoJs6.git,
Directory (目录) 处可根据需要修改为特定路径.
点击 Clone (克隆) 按钮, 等待 AutoJs6 项目资源在设备本地完成克隆.

注: 上述过程可能需要安装 Git (分布式版本控制系统).

AutoJs6 项目构建

克隆完成后, Android Studio 将打开 AutoJs6 的项目窗口, 并自动完成初步的 Dependencies (依赖) 下载及 Gradle 构建工作.

注: 上述过程可能非常耗时. 若网络条件欠佳, 可能需要重试多次 (点击 Retry 按钮).

构建完成后, Android Studio 的 Build 标签页将出现类似 BUILD SUCCESSFUL in 1h 17m 34s 的消息.

打包项目并生成可安装到安卓设备的 APK 文件:

  • 调试版 (Debug Version)
    • Build (构建) -> Build Bundle(s) / APK(s) -> Build APK(s)
    • 生成带默认签名的调试版安装包
    • 路径示例: "D:\AutoJs6\app\build\outputs\apk\debug\"
  • 发布版 (Release Version)
    • Build (构建) -> Generate Signed Bundle / APK
    • 选择 APK 选项
    • 准备好签名文件 (新建或选取), 生成已签名的发布版安装包
    • 路径示例: "D:\AutoJs6\app\release\"

参阅: Android Docs

@SuperMonster003 SuperMonster003 added Feedback Awaited 🕒 等待反馈 Waiting for the feedback from issue creater and issue will be closed if duration is over one month Glitch ☂️ 小问题 Usually an issue easy to resolve labels Apr 30, 2023
@SuperMonster003 SuperMonster003 added Stale 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month) and removed Feedback Awaited 🕒 等待反馈 Waiting for the feedback from issue creater and issue will be closed if duration is over one month labels May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Glitch ☂️ 小问题 Usually an issue easy to resolve Stale 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month)
Projects
None yet
Development

No branches or pull requests

2 participants