回复
鸿蒙Next使用ArkUI-X跨平台开发体验 原创
auhgnixgnahz
发布于 2025-6-12 21:20
浏览
0收藏
移动端的跨平台开发语言有很多,今天体验一些鸿蒙ArkUI-X运行到安卓设备上。
ArkUI是一套构建分布式应用的声明式UI开发框架。它具备简洁自然的UI信息语法、丰富的UI组件、多维的状态管理,以及实时界面预览等相关能力,帮助您提升应用开发效率,并能在多种设备上实现生动而流畅的用户体验。
ArkUI-X进一步将ArkUI扩展到Android平台,实现对接Android平台的适配,开发者基于一套ArkTS主代码,就可以构建Android平台的精美、高性能应用。
第一步:首先安装一下ArkUI-X SDK

第二步:安装完会有环境检测,按需求配置

第三步:新建一个ArkUI-X的项目

第四步:简单粗暴,将之前写得底部导航代码拷贝过来
第五步:编译APP,等待编译结果

第六步:将编译生成的.apk安装到安卓设备上看一下效果

版本软件和平台配套关系
| 目标平台 | 兼容OS版本 |
|---|---|
| OpenHarmony | 5.0.1 Release (API Version 13) |
| HarmonyOS | 5.0.1 Release (API Version 13) |
| Android | Android 8<sup>+</sup> (API level 26<sup>+</sup>) |
| iOS | iOS 10<sup>+</sup> |
| ArkUI-X自动生成的安卓工程中application和activity代码: |
public class MyApplication extends StageApplication {
private static final String LOG_TAG = "HiHelloWorld";
private static final String RES_NAME = "res";
@Override
public void onCreate() {
Log.e(LOG_TAG, "MyApplication");
super.onCreate();
Log.e(LOG_TAG, "MyApplication onCreate");
}
}
public class EntryEntryAbilityActivity extends StageActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.e("HiHelloWorld", "EntryEntryAbilityActivity");
setInstanceName("com.sany.harmony.digger:entry:EntryAbility:");
super.onCreate(savedInstanceState);
}
}
在arkts中配置了网络权限,在安卓工程的AndroidManifest中也增加了相应的权限:
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/arkuix"
android:label="@string/app_name"
android:extractNativeLibs="true"
android:supportsRtl="true"
android:theme="@android:style/Theme.Light.NoTitleBar">
<activity android:exported="true" android:name=".EntryEntryAbilityActivity"
android:windowSoftInputMode="adjustResize |stateHidden"
android:configChanges="orientation|keyboard|layoutDirection|screenSize|uiMode|smallestScreenSize|density">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
分类
已于2025-7-10 09:13:28修改
赞
收藏
回复
相关推荐




















