
回复
移动端的跨平台开发语言有很多,今天体验一些鸿蒙ArkUI-X运行到安卓设备上。
ArkUI是一套构建分布式应用的声明式UI开发框架。它具备简洁自然的UI信息语法、丰富的UI组件、多维的状态管理,以及实时界面预览等相关能力,帮助您提升应用开发效率,并能在多种设备上实现生动而流畅的用户体验。
ArkUI-X进一步将ArkUI扩展到Android平台,实现对接Android平台的适配,开发者基于一套ArkTS主代码,就可以构建Android平台的精美、高性能应用。
目标平台 | 兼容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>