在虚拟机上运行安卓app注意项

本文介绍了在虚拟机上运行安卓APP时遇到的Cleartext communication错误,提供了详细的解决方案。通过在res目录下创建network_security_config.xml文件,配置网络安全策略来解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在虚拟机上运行安卓app注意项

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

开发工具与关键技术:studio64,Java

作者:陈显其

撰写时间:2020年5月28日

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

在虚拟机上运行安卓app时可能报CLEARTEXT communication to 10.0.2.2 not permitted by network security policy错误,想要解决这个问题,首先在 res 下新建一个 xml 目录,然后创建一个名为:network_security_config.xml 文件 ,该文件内容如下

Android虚拟机Dalvik完整源码,宝贵资源,欢迎下载! This directory contains the Dalvik virtual machine and core class library, as well as related tools, libraries, and tests. A note about the licenses and header comments --------------------------------------------- Much of the code under this directory originally came from the Apache Harmony project, and as such contains the standard Apache header comment. Some of the code was written originally for the Android project, and as such contains the standard Android header comment. Some files contain code from both projects. In these cases, the header comment is a combination of the other two, and the portions of the code from Harmony are identified as indicated in the comment. Here is the combined header comment: /* * Copyright (C) The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ---------- * * Portions of the code surrounded by "// BEGIN Harmony code" and * "// END Harmony code" are copyrighted and licensed separately, as * follows: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Native SH call bridge --------------------- Native SH call bridge is written by Shin-ichiro KAWASAKI and Contributed to Android by Hitachi, Ltd. and Renesas Solutions Corp.
### 下载并配置 QT SDK #### 1. 下载 Qt Installer 访问官方提供的链接地址 `https://download.qt.io/archive/qt/5.14/5.14.2/qt-opensource-mac-x64-5.14.2.dmg`,下载适用于 macOS 的 Qt 安装文件[^1]。此版本为开源版,适合大多数开发者需求。 #### 2. 虚拟机中的安装过程 在虚拟机环境中完成以下操作: - **启动安装程序** 将 `.dmg` 文件挂载到虚拟机的磁盘管理器中,并双击打开安装向导。按照提示逐步执行安装步骤。 - **选择组件** 在安装过程中可以选择需要的功能模块,例如 Qt Creator IDE 和目标平台的支持工具链(如 Android 或桌面应用)。如果计划扩展至其他操作系统,则需勾选对应选。 #### 3. 配置开发环境变量 为了使命令行能够识别 Qt 工具集,在终端编辑 shell 配置文件(如 `.bashrc` 或 `.zshrc`),添加路径声明: ```bash export PATH=/path/to/Qt/Tools/QtCreator/bin:$PATH ``` 确认替换 `/path/to/Qt` 为你实际解压后的目录位置。 --- ### 编译支持 Android 平台的应用 当涉及跨平台目时,可能需要用到 Android NDK 来构建应用程序。以下是具体方法: - **准备依赖** - Java JDK 可通过包管理器快速部署:`sudo apt-get install default-jdk` - 获取最新版 Android SDK 和 NDK,推荐从 Google 开发者站点获取稳定发行版[^2]。 - **设置交叉编译参数** 修改目的 `.pro` 文件或者直接利用 Qt Creator GUI 设置如下字段: ```plaintext android { QMAKE_APP_FLAGS += --target=arm-linux-androideabi \ --sysroot=$$ANDROID_NDK/platforms/android-21/arch-arm/ } ``` 注意调整 `--sysroot` 参数指向本地已安装好的 NDK 对应架构子目录。 --- ### RK3568 相关开发补充说明 对于嵌入式硬件设备(比如基于 Rockchip RK3568 处理器的产品),可以参考相关文档来定制化 U-boot、Linux Kernel 和根文件系统镜像[^3]。通常情况下会经历两个阶段的工作流——首先是基础固件生成;其次是高级别的 Linux 发行版适配工作。 如果有意深入研究该领域,《RK3568 开发笔记系列》提供了详尽指导材料,建议查阅相关内容作为辅助参考资料。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值