Run into Android App Dock
- Select Run to Android App Dock
- Select the running project
1. Connect the mobile phone and choose to transfer files on the mobile phone.
2. Open设置
->关于本机
->版本信息
-> Click 4-5 times in succession版本号
, enter your phone password, and the system will enter developer mode.
3.设置
>其他设置
>开发者选项
> Open开发者选项
> OpenUSB调试
.
4. Return to Hbuilder, click Refresh, select the device, and run the project.
- Failed to run.
请使用手机助手手动安装XXX.apk到手机上,并重新运行真机调试
I don’t know why the files can’t be transferred to the phone. Even after downloading the file assistant, I can’t connect to the phone. So use the simplest method.
This error is because Hbuilder cannot send and install the apk to the mobile phone. Open the directory it saysC:\Users\[自己的目录]\Downloads\HBuilderX.3.7.11.20230427\HBuilderX\plugins\launcher\base\android_base.apk
, directly send the apk to the mobile phone via WeChat, then manually change the name, click Install, and this icon will appear after installation.
After installation, return to the computer Hbuilder and run it again.
Error occurred:
Failed to connect to localhost/127.0.0.1:8080
Turn off HBuilder on mobile phone, recompile on computer, just try twice more.
Run into emulator
- Download and install Android Studio. The official uni-app provides a download address and installation tutorial. I will talk about something the official does not explain in detail here. After downloading, just click down by default during installation. After installing studio.
遇到的问题
1. Click on SDK Manager and find that there is no SDK Platform. Follow this tutorial , it's really detailed.
2. Modify the SDK directory, and then the installation fails. It does not report an error, it means that the package already exists, so the existing package is used. After seeing this comment, I modified the path and moved it one level up.
3. Failed to download the package: Because I have "technology" support, the agent here chooses Auto-detect. You can try itCheck connection
. From the details downloaded later, you can see thathttps://dl.google.com
the installation package is downloaded from, so just use this URL to test. If this test is successful, it means that there is no problem with the subsequent installation network.
The following log must appear to indicate that it has been installed成功
, otherwise you will not be able to select the sdk platform and sdk tools when you click finish.
Just follow the detailed tutorial above and continue. God knows how long I tried before I finally succeeded. A handful of bitter tears. - Android native project configuration. You can refer to the uni-app tutorial , which is recommended as
方式二:导入工程
the bread is already placed. I will mainly explain some details not mentioned here and the problems I encountered.
1. This HBuilder-Integrate-AS project is in the downloaded App offline SDK. aaptOptions has been placed in build.gradle.
2.Androidmanifest.xml
Undermanifests
the directory, labels have been placedmeta-data
. Just change the value.
- Apply for a signed appkey
1. Open the Developer Center ,应用管理
>我的应用
> click Application to view application information. ClickAndroid云端证书
, if it has not been generated, click Generate Certificate. After the click is generated , the // information证书详情
is recorded . 2. Click , the original one has been migrated. Click to add platform information. Fill in the SHA and MD5 information recorded previously, and the package name is that of the Android studio project . 3. After adding it, move to the end of the table and you can see that the table has one column . If it has not been generated before, click Create and there will be a pop-up window. Anyway, just click Create. After it's done, this will turn into View. Click View to see the App Key, which is the offline key. Put this in AndroidManifest.xml in the project.MD5
SHA1
SHA256
各平台信息
离线打包Key管理
新增
applicationId
离线打包Key
issued
Hbuilder select 发行
> 原生App-云打包
The cloud certificate here is the one previously generated in Dcloud.
There will be a pop-up prompt in the middle:
打包校验:[Warning] 为落实《网络安全法》《消费者权益保护法》的要求,有效治理App强制授权、过度索权、超范围收集个人信息等现象,保障个人信息安全国内各大应用市场都加强了应用审核,要求应用必须符合相关政策才能上架查看如何解决。不上架国内应用市场无需处理
If this is just to verify the effect of the apk, you can continue to package it first, but if you want to put it on the domestic application market, you have to go to the provided (link) [https://uniapp.dcloud.net.cn/tutorial/ Configure the relevant privacy statements in app-privacy-android.html#].
After packaging, there will be a prompt. Just transfer the apk file to your phone and run it to see the effect.
Error: java.net.SocketTimeoutException: Connect timed out
Android studio proxy settings, check connection as long as you can connect to https://dl.google.com.
The following is my program:
Reference:
Common errors reported when running on official real machines